The ADO.NET provider with invariant name 'System.Data.SqlLite.EF6' is either not registered in the machine or application config file,
-
I hate to ask this question, but this is my first time using SQLite from the nuGet package. System.Data.SQLite (x86/x64) and it installed EF6, SQLite Core, SQLite EF6, SQLite LINQ I wrote a DLL for the DAL, and a DLL for the SQL Linq Call. Then I wrote a function to just get a count from the table to trigger creating the database. I tested it using SQL Server and it worked fine. Created the database and tables, then seeded the tables. So then I switch over to SQLite. Adjusted the App.Config file - see below This App.Config is from the main program project. I have App.Configs in the DLL's as well, not sure If I need them or not.
-
I hate to ask this question, but this is my first time using SQLite from the nuGet package. System.Data.SQLite (x86/x64) and it installed EF6, SQLite Core, SQLite EF6, SQLite LINQ I wrote a DLL for the DAL, and a DLL for the SQL Linq Call. Then I wrote a function to just get a count from the table to trigger creating the database. I tested it using SQL Server and it worked fine. Created the database and tables, then seeded the tables. So then I switch over to SQLite. Adjusted the App.Config file - see below This App.Config is from the main program project. I have App.Configs in the DLL's as well, not sure If I need them or not.
Well first off, SQLite doesn't support automatic database creation, you have to manually create the database. So I added that add-in to my Firefox and created the database. I'm wondering if this is worth the time. This program uses old Dbase IV or Foxpro database files, and I wanted to use something faster and more modern for a new program feature that stores all the emails sent in the database, so if one fails it can be resent. This kicked my butt, but I don't get an error anymore. I couldn't figure out the App.Config part the way the bulk of examples showed, but I did figure out how to point the database to a network drive via code in the Application, and pass it to EF6 DAL. So in case your looking for an example of how to point SQLite to a network drive without hard coding the path, this is it, well I think it is, until something better comes along. I apologize in advance for this being in VB. All the examples where in C# My project has 3 modules, because it's getting too large in size. Main Project EXE Data Access Layer DLL Entity DLL I went back and stripped out the SQLite from the main project and Entity DLL and just installed it in the DAL DLL. Then just made references for SQLite back to the DAL. Then stripped out the SQLite and EF stuff in the App.Configs of DLL's So in the DBContext class in my DAL, I added the conn string to use in New()
Public Class ameContext
Inherits DbContextPublic Shared Property DefaultConnectionFactory As IDbConnectionFactory
Public Sub New(ByVal conString As String) '<< I added the conn string to use
MyBase.New(conString) 'SQLite doesn't support auto database creation Entity.Database.SetInitializer(Of ameContext)(Nothing)
End Sub
End NameSpaceThen I added a SQLiteConfiguration File to my DAL Class, which gets called from the DBContext above.
Imports System.Data.SQLite
Imports System.Data.SQLite.EF6Imports System.Linq
Imports System.Text
Imports System.Data.Entity.Core.Common
Imports AccountMate_DALNamespace System.Data.SQLite.Entity
Public Class SQLiteConfiguration Inherits DbConfiguration Public Sub New() SetProviderFactory("System.Data.SQLite", SQLiteFactory.Instance) SetProviderFactory("System.Data.SQLite.EF6", SQLiteProvid