我有使用SQLite的数据库与EF CTP5一个非常困难的时期。我只是想执行这个MSDN例如中使用SQLite。但在该行
VAR食品= db.Categories.Find(食物);
我得到一个运行时异常 - System.Data.SQLite.SQLiteException(0X80004005):SQLite的errorno如表所示:分类
我不知道如何解决这个问题。请帮我。
注:app.config文件已被修改,如下所示:
的App.config
<结构>
<启动useLegacyV2RuntimeActivationPolicy =真正的>
< supportedRuntime版本=V4.0/>
< /启动>
<运行>
< generatePublisherEvidence启用=FALSE/>
< /运行>
< System.Data这>
< DbProviderFactories>
<清除不变=System.Data.SQLite/>
<添加名称=SQLite的数据提供程序不变=System.Data.SQLite
说明=.NET Framework数据提供的SQLite
TYPE =System.Data.SQLite.SQLiteFactory,System.Data.SQLite,版本= 1.0.66.0,文化=中性公钥= db937bc2d44ff139/>
< / DbProviderFactories>
< /system.data>
<的ConnectionStrings>
<添加名称=ProductContext的connectionString =数据源= D: codeFirst.db;版本= 3;新= TRUE;的providerName =System.Data.SQLite/>
< /的ConnectionStrings>
< /结构>
解决方案
在我看来,目前的SQLite.net不支持实体框架CTP5 code第一。将不得不等待这样的事情发生。
I am having a very hard time in using the SQLite db with EF CTP5. I was just trying to execute this MSDN example with SQLite. But at the line
var food = db.Categories.Find("FOOD");
I am getting a runtime exception - System.Data.SQLite.SQLiteException (0x80004005): SQLite errorno such table: Categories
I have no idea how to resolve this issue. Please help me out.
Note : The app.config file has to be modified and is as follows:
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>
解决方案
It seems to me that current SQLite.net does not support Entity Framework CTP5 code first. Will have to wait for that to happen.
相关推荐
最新文章