我知道在这个主题上已经有几个类似的问题了,但是其中很多都来自SQLite的旧版本,据我所知,它并没有完全支持EF 6.我已经尝试过这些线程的无数建议,要么是做错了,要么是必须改变的.
我正在使用VS 2013,面向.NET 4.5.1,并已从system.data.sqlite.org下载页面安装了sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe软件包,以及来自NuGet Manager的System.Data.SQLite EF6包(安装EF6).
下面是我当前的App.config文件(除了我尝试将Version,Culture和Public键变量添加到类型中之外,它几乎没有变化):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<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, Version=1.0.96.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework …Run Code Online (Sandbox Code Playgroud)