I try to setup sqllite provider for entity framework from code (w/o web.config). I have prepared DbConfiugration
:
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.SQLite.EF6;
namespace Infrastructure
{
internal class MyDbConfiguration: DbConfiguration
{
public MyDbConfiguration()
{
SetDefaultConnectionFactory(new LocalDbConnectionFactory("v11.0"));
SetProviderFactory("System.Data.SQLite.EF6", new SQLiteProviderFactory());
}
}
}
But when try to use DbContext, the following error is used:
System.NotSupportedException: 'Unable to determine the provider name for provider factory of type 'System.Data.SQLite.SQLiteFactory'. Make sure that the ADO.NET provider is installed or registered in the application config.
How can I configure EF to use SQLite's provider in code, without using web.config?