Reputation: 495
Unexpected exception occurred when generating the model. See output window for more details. Exception message: '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.'.
The above error occurs when I try and simply refresh my model (in the designer for my edmx file). I have a DB that I created, but I was trying to add a table when I first got this exception. Now, simply refreshing the model causes the exception. To the best of my knowledge, I haven't modified anything else.
I've googled the hell out of this, but I'm at my wits end.
I'm using VS2017, EF6 and SQLite (v3 I think).
Here is my App.config:
<?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" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v13.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="NavAidDBEntities" connectionString="metadata=res://*/NavAidModel.csdl|res://*/NavAidModel.ssdl|res://*/NavAidModel.msl;provider=System.Data.SQLite.EF6;provider connection string='data source="C:\SVN\SealiteSystems\NAM DB Manager\NAM DB.db"'" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
Upvotes: 3
Views: 2193
Reputation: 61
I was facing the same issue with visual studio 2017 version 15.7.5
.I did every thing but nothing worked . I think this issue remains till version 15.8.0
is released . Once I updated the the visual studio 2017 version to 15.9.12
(current version) , This is resolved now .
Please find the yellow notification flag on the top of your visual studio , click there and update your visual studio version .
Upvotes: 0
Reputation: 666
There is an issue with EF 6.2 which came along with the Visual Studio 2017 15.7 update that prevents the EDMX being generated with SQLite.
The work around is to add the following to machine.config in the system.data -> DbProviderFactories section.
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
My full section now looks like this
<system.data>
<DbProviderFactories>
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6, Version=1.0.108.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
For more details see https://github.com/ErikEJ/SqlCeToolbox/wiki/EF6-workflow-with-SQLite-DDEX-provider
Upvotes: 5