I would like to use the Entity Developer in a Core 5.0 console app along with Microsoft.Data.SQLite drivers.
When I try to add a Devart EF Core Model I have to address the database(file) to be handled.
So far so easy.
When I then click to check database connection I get the followin error message: "You need to call SQLitePCL.raw.SetProvider(). If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init()".
Does this mean I have to use the Devart dotConnect for SQLite in any case or is there any possibility to also use the Mircrosoft SQLite items.
This is new for me - have up to now only handled .Net Framework and Entity Developer.
I will be very curious for any answer!
Greetings
Jochen
Entity Developer, Microsoft SQLite Driver, You need to call SQLitePCL.raw.SetProvider()
Re: Entity Developer, Microsoft SQLite Driver, You need to call SQLitePCL.raw.SetProvider()
1. Please run the following commands in Package Manager Console of your .NET 5 project:
JIC: system.data.sqlite is loaded from local NuGet cache and used for design-time features of Entity Developer, but the EF Core code will be generated for microsoft.entityframeworkcore.sqlite
2. Run Create Model Wizard of Devart EF Core Model and choose "Microsoft SQLite Data Provider".
Code: Select all
PM> install-package system.data.sqlite
PM> uninstall-package system.data.sqlite
PM> install-package microsoft.entityframeworkcore.sqlite
2. Run Create Model Wizard of Devart EF Core Model and choose "Microsoft SQLite Data Provider".
Re: Entity Developer, Microsoft SQLite Driver, You need to call SQLitePCL.raw.SetProvider()
Shalex, thank you very much for your reply - but, it didn't help ...
Honestly I have to tell that I wanted to start a "Database first" job.
So I created a new project, followed your advices and added a Devart EF Core Model. After that I was asked for the database provider (which I already had after installing "Microsoft.EntityFrameworkCore.Sqlite.Core". After that I provided the location of the SQLite database file.
Next step was then to check the database connection - but: same error message than before.
So I was not able to run the model creator ...
Any other suggestions?
Honestly I have to tell that I wanted to start a "Database first" job.
So I created a new project, followed your advices and added a Devart EF Core Model. After that I was asked for the database provider (which I already had after installing "Microsoft.EntityFrameworkCore.Sqlite.Core". After that I provided the location of the SQLite database file.
Next step was then to check the database connection - but: same error message than before.
So I was not able to run the model creator ...
Any other suggestions?
Re: Entity Developer, Microsoft SQLite Driver, You need to call SQLitePCL.raw.SetProvider()
1. You chose "Microsoft SQLite Data Provider" in Create Model Wizard of Devart EF Core Model, didn't you?
2. When the error occurs, run the 2nd instance of Visual Studio, navigate to Debug > Attach to Process and attach to the first VS (where you launched Create Model Wizard). Then, open Debug > Windows > Modules. Is System.Data.SQLite.dll loaded in the process? If yes, specify its full path.
3. As a workaround, try using a standalone Entity Developer.
2. When the error occurs, run the 2nd instance of Visual Studio, navigate to Debug > Attach to Process and attach to the first VS (where you launched Create Model Wizard). Then, open Debug > Windows > Modules. Is System.Data.SQLite.dll loaded in the process? If yes, specify its full path.
3. As a workaround, try using a standalone Entity Developer.
Re: Entity Developer, Microsoft SQLite Driver, You need to call SQLitePCL.raw.SetProvider()
It works!
I simply let "System.Data.SQLite" stay in the project w/o deleting it!
After that the createion of the model using Entity Developer is possible. At the end of this process "Microsoft.EntityFrameworkCore.Sqlite.Core" is installed (by Entity Developer)
Not clear is whether data can be read an write because of my lack in time to chack that already - but indeed this shall work!
Thank you very much for your hints, Shalex.
Greetings, Jochen!
I simply let "System.Data.SQLite" stay in the project w/o deleting it!
After that the createion of the model using Entity Developer is possible. At the end of this process "Microsoft.EntityFrameworkCore.Sqlite.Core" is installed (by Entity Developer)
Not clear is whether data can be read an write because of my lack in time to chack that already - but indeed this shall work!
Thank you very much for your hints, Shalex.
Greetings, Jochen!