Tôi đang gặp khó khăn trong việc sử dụng db SQLite với EF CTP5. Tôi chỉ cố gắng thực hiện điều này MSDN example với SQLite. Nhưng tại dòngLàm thế nào để làm cho Entity Framework CTP5 hoạt động với SQLite?
var food = db.Categories.Find("FOOD");
Tôi nhận được một ngoại lệ thời gian chạy:
System.Data.SQLite.SQLiteException (0x80004005): errorno SQLite bảng như: Categories
Lưu ý: tệp app.config phải được sửa đổi và như sau:
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>
Có thể diễn đàn EF trong trang web System.Data.SQLite là một nơi tốt hơn để hỏi? http://sqlite.phxsoftware.com/forums/29.aspx –