我收到这个错误与Nite的sqlite 1.0.94.1包.我用各种app.config部分,在类似于这个包的以前版本的问题帮助下,但我无法让它工作.以下是我在安装Nuget软件包后发现的app.config.我在安装之前删除了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" /> </configSections> <!--Added by me,the rest of the app.config was constructed by installing the sqlite package --> <connectionStrings> <add name="PrivateMessengerContext" connectionString="DataSource=|DataDirectory|\PrivateMessengerDb.db" providerName="System.Data.sqlite.EF6"/> <add name="PasswordContext" connectionString="DataSource=|DataDirectory|\PasswordDb.db" providerName="System.Data.sqlite.EF6"/> </connectionStrings> <system.data> <!-- NOTE: The extra "remove" element below is to prevent the design-time support components within EF6 from selecting the legacy ADO.NET provider for sqlite (i.e. the one without any EF6 support). It appears to only consider the first ADO.NET provider in the list within the resulting "app.config" or "web.config" file. --> <DbProviderFactories> <add name="sqlite Data Provider" invariant="System.Data.sqlite" description=".NET Framework Data Provider for sqlite" type="System.Data.sqlite.sqliteFactory,System.Data.sqlite" /> <remove invariant="System.Data.sqlite" /> <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" /> </DbProviderFactories> </system.data> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory,EntityFramework"> <parameters> <parameter value="mssqllocaldb" /> </parameters> </defaultConnectionFactory> <providers> <provider invariantName="System.Data.sqlClient" type="System.Data.Entity.sqlServer.sqlProviderServices,EntityFramework.sqlServer" /> <provider invariantName="System.Data.sqlite.EF6" type="System.Data.sqlite.EF6.sqliteProviderServices,System.Data.sqlite.EF6" /> </providers> </entityFramework> </configuration>
再添加一个提供商
原文链接:https://www.f2er.com/sqlite/197842.html< provider invariantName =“System.Data.sqlite”type =“System.Data.sqlite.EF6.sqliteProviderServices,System.Data.sqlite.EF6”/>
移动
< add name =“sqlite Data Provider”invariant =“System.Data.sqlite”description =“.NET Framework Data Provider for sqlite”type =“System.Data.sqlite.sqliteFactory,System.Data.sqlite”/>
怒吼
< remove invariant =“System.Data.sqlite”/>
并将提供程序名称更改为在您的连接字符串中的providerName =“System.Data.sqlite”.
编辑:
参见http://system.data.sqlite.org/index.html/tktview/2be4298631c01be99475