Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6055213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:14:25+00:00 2026-05-23T08:14:25+00:00

Last year, I used SubSonic 3 and SQLite in a VS2008 project very successfully

  • 0

Last year, I used SubSonic 3 and SQLite in a VS2008 project very successfully and was quite pleased with the results. Just recently, I tried to setup SubSonic 3 and SQLite in a VS2010 project and have been met with the inner exception when trying to instantiate a new SimpleRepository:

The type initializer for
‘System.Data.SQLite.SQLiteFactory’
threw an exception

Just to make sure I wasn’t going crazy, I tried the exact same code and app.config file in VS2008 and no problem. Weird!

Currently, I’m using SubSonic 3.0.0.4 and the x64 version of System.Data.SQLite 1.0.73.0 (3.7.6.3) (though I tried the 32 bit version as well.) I added both DLLs as a Reference and set “Copy Local” to TRUE.

My App.Config looks like:

  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>

  <connectionStrings>
    <add name="myDatabase" connectionString="Data Source=C:\DB\mydatabase.db3" providerName="System.Data.SQLite"/>
  </connectionStrings>

And my code looks like:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SubSonic.Repository;

namespace SubSonicSqliteTestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var repo = new SimpleRepository("myDatabase", SimpleRepositoryOptions.RunMigrations);
        }
    }
}

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:14:25+00:00Added an answer on May 23, 2026 at 8:14 am

    I am using SubSonic 3 with Visual Studio 2010 and SQLite 1.0.66 and it works.
    However there are a few things you have to do:

    • Your application has to be x86 (not AnyCPU) or you get a BadImageFormatException on 64 bit machines
    • You have to change the Target Framework from “Framework 4.0 Client Profile” to “Framework 4.0”
    • You have to add (or modify) this to your app.config file. SQLite won’t work without the useLegacyV2RuntimeActivationPolicy flag set to true

      <startup useLegacyV2RuntimeActivationPolicy="true">
          <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
      </startup>
      
    • My Factory initialisation code looks like this (it includes the Version and the PublicKeyToken). I got this settings from the machine.config file on my dev machine where I ran the setup and have choosen to integrate SQLite to Visual Studio 2010 (from the All Programs\SQLite folder). The file is located @ %WinDir%\Microsoft.NET\Framework\<FrameworkVersion>\CONFIG

      <system.data>
          <DbProviderFactories>
      
              <remove invariant="System.Data.SQLite" />
              <add name="SQLite Data Provider" invariant="System.Data.SQLite"
                         description=".Net Framework Data Provider for SQLite"
                         type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
      
          </DbProviderFactories>
      </system.data>
      
    • My connection strings contains slashes instead of backslashes in the path and contains a version

      <connectionStrings>
          <add name="connectionstringname"
                     connectionString="Data Source=c:/temp/mydatabase.db;Version=3;"
                     providerName="System.Data.SQLite"/>
      </connectionStrings>
      

    Hope that helps.

    Update:
    I see you use a x64 version of SQLite, so forget about the first hint. But I leave it, maybe it is helpful for others.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I havent used lucene. Last time i ask (many months ago, maybe a year)
Last year I developed a data access service for our project using Entity Framework
I started this website last year, along with a facebook page. http://www.facebook.com/textbookcentral I just
As a java web applications developer I have used this last year JSF (SUN)
I put a site together last year and used a MooTools object someone else
I was working with VB6 last year and I used an Add-on that made
It's been over a year since I last used OpenGL so I'm rusty on
Last year, Scott Guthrie stated You can actually override the raw SQL that LINQ
Within the last year I have become addicted to subversion. I am an only
First a little intro: Last year i wrote this http://dragan.yourtree.org/code/canvas-3d-graph/ Now, i want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.