我在使用SQLite db和EF CTP5方面遇到了很大的困难。我只是想用MSDN示例来执行SQLite。但在线上
var food = db.Categories.Find("FOOD");我得到了一个运行时异常:
System.Data.SQLite.SQLiteException (0x80004005):SQLite错误表:类别
注意:必须修改app.config文件,其内容如下:
App.config
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
<runtime>
<generatePublisherEvidence enabled="false" />
</runtime>
<system.data>
<DbProviderFactories>
<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, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="ProductContext" connectionString="Data Source=D:\CodeFirst.db;Version=3;New=True;" providerName="System.Data.SQLite" />
</connectionStrings>
</configuration>发布于 2011-02-13 15:10:32
在我看来,当前的SQLite.net首先不支持实体框架CTP5代码。就得等那事发生了。
发布于 2011-08-14 20:38:27
你可以看到这个:
http://www.devart.com/blogs/dotconnect/index.php/entity-framework-code-first-support-for-oracle-mysql-postgresql-and-sqlite.html
发布于 2013-01-03 21:06:02
添加
Database.SetInitializer<MyDataContext>(null);为我工作。我首先与EF5一起使用Sqlite代码
https://stackoverflow.com/questions/4901198
复制相似问题