I am attempting to change the database provider for a project that uses Entity Framework 6.4.4 from SQL Server to SQLite.
I have the SQLite nuget package installed on the project as well as the SQLite toolbox extension for VS2022. The project already has an .edmx
file describing the database I would like to build. However, when I attempt to generate the database (via the Generate Database Wizard), SQLite is not available as a Data Source:
I have read some posts about this issue and many advise installing the packages found here: https://system.data.sqlite.org/index.html/doc/trunk/www/news.wiki
However, these packages do not include Visual Studio 2022, nor do they include .NET Framework 4.8.
I am able to create and manage SQLite databases via the SQLite Toolbox extension, but that functionality does not extend to the DB Creation Wizard.
My app.config
is shown below. This should be looking for SQLite as a DB provider. I've made sundry edits to this file to no effect.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework"
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SQLite"
type="System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite" />
</providers>
</entityFramework>
<connectionStrings>
<add name="PSRtestDB.db"
connectionString="data source=C:\Users\adamsc\Documents\TEMP\PSR DB\PSRtestDB.db"
providerName="System.Data.SQLite" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
The question below appears to imply that this simply can't be done, that the DB must be created manually if SQLite is to be used. I would appreciate confirmation on that from anyone who has experience in this area.
Entity Framework 6 not creating tables in SQLite database
I am stymied and unsure what to try. Does anyone have any suggestions? Thanks in advance.