【发布时间】:2015-11-26 21:46:27
【问题描述】:
在参考了几乎所有与此问题相关的问题后。我无法找到解决此问题的方法。
我遵循了提到的所有步骤。
1)从 sqlite.org 下载包
2)从nuget安装包
仍然没有出现在实体模型向导的数据源列表中。
我的 app.config 看起来像这样。
<?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="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.Linq, Version=1.0.98.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite" />
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" /> </DbProviderFactories>
</system.data>
</configuration>
我几乎尝试了所有方法,但未能获得使用实体框架连接到 sqlite 所需的基本步骤,然后读取数据库。
我使用 DB Browser for sqlite 创建了数据库,可以通过简单的 ADO.NET 方法访问。
一旦 sqlite 显示在数据源下,然后。存在提供者错误。 比如
No-Entity-Framework-provider-found-for-the-ADO-NET
有人可以帮我完成从设置环境到在 Visual Studio 2013、.NET 4.5.1、wpf、mvvm 中对 sqlite 数据酶执行操作的完整步骤。 任何帮助表示赞赏。
【问题讨论】:
-
我看到你有一个连接工厂,但你的配置文件中没有连接字符串,你的代码中的连接字符串在某处吗?
-
连接字符串在那里。然后我将其删除并尝试再次添加数据库。没有发生。
标签: c# wpf entity-framework sqlite visual-studio-2013