I\'m trying to use Entity Framework with SQLite. I had issues integrating it into my main application, so I started a little test from scratch, exactly following the directi
For anyone using the code based setup and still getting the same exception: I needed to additionally set the connection factory in kjbartel's answer.
public class SQLiteConnectionFactory : IDbConnectionFactory
{
public DbConnection CreateConnection(string nameOrConnectionString)
{
return new SQLiteConnection(nameOrConnectionString);
}
}
Then set the default connection factory in SQLiteConfiguration
public class SQLiteConfiguration : DbConfiguration
{
public SQLiteConfiguration()
{
SetDefaultConnectionFactory(new SQLiteConnectionFactory());
SetProviderFactory("System.Data.SQLite", SQLiteFactory.Instance);
SetProviderFactory("System.Data.SQLite.EF6", SQLiteProviderFactory.Instance);
Type t = Type.GetType( "System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6");
FieldInfo fi = t.GetField("Instance", BindingFlags.NonPublic | BindingFlags.Static);
SetProviderServices("System.Data.SQLite", (DbProviderServices)fi.GetValue(null));
}
}