我在将 SQLite 数据库与 EF CTP5 一起使用时遇到了非常困难。我只是想执行这个MSDN 示例 http://blogs.msdn.com/b/adonet/archive/2010/12/06/ef-feature-ctp5-code-first-walkthrough.aspx?wa=wsignin1.0与 SQLite。但在一线
var food = db.Categories.Find("FOOD");
我收到运行时异常:
System.Data.SQLite.SQLiteException(0x80004005):SQLite错误没有这样的表:类别
注意: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>
在我看来,当前的 SQLite.net 首先不支持实体框架 CTP5 代码。必须等待那件事发生。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)