c# - SQLite 连接未出现在实体数据模型向导中

标签 c# database entity-framework sqlite

我做了什么才能到达现在的位置: 我从 http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki 安装了程序集使用 GAC 和 VS2012 选项。

我现在可以连接到现有的 SQLite 数据库,或者连接并创建一个新的 SQLite 数据库文件。

此连接将出现在我的服务器资源管理器中并且工作正常。 我可以从资源管理器中查看此数据库并更改表等。

但是,当我尝试添加一个新的ADO.NET 实体数据模型时,这个已经建立的连接将不会出现在可用的数据连接中。 即使我随后继续建立新连接,System.Data.SQLite 数据库文件 选项甚至都不在选项列表中。

我已经尝试使用 NuGet 单独安装实体包或与 SQLite 包一起安装。我试过不安装它们或只安装实体模型与前面提到的程序集,但 SQLite 的选项不会出现。

在用谷歌搜索并浏览了令人沮丧的时间后,发现只有少数人和我有同样的问题,但没有适合我的解决方案,我来找你寻求帮助。

经过我所有的努力,我怀疑它归结于我的 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" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <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>

类似问题:

Database first create entity framework 6.1.1 model using system.data.sqlite 1.0.93

http://sqlite.1065341.n5.nabble.com/Provider-not-showing-up-in-Net-Model-import-wizard-td75306.html

我使用的是 vs2012 .NET 4.5,SQLite 版本 1.0.96.0,实体 6.1.3

我希望有人能够帮助我。

最佳答案

安装 Entity Framework 6.1.3 工具 - 从这里下载:http://www.microsoft.com/en-us/download/details.aspx?id=40762

关于c# - SQLite 连接未出现在实体数据模型向导中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29289701/

相关文章:

c# - Code First 和 EF 5.0 不加载导航属性

由 C# 锁定

c# - 使用条件/三元 ("?:") 运算符进行转换

mysql - 创建表而不预先定义列数

c# - 尝试使用 LINQ 以数据库字段作为参数获取不同的值

c# - 如何使用 FK 设置集合属性?

c# - 从 .net 客户端访问 ssl 服务器(web 服务)

c# - ODP.NET 托管 - 无法找到请求的 .Net Framework 数据提供程序

mysql - 如何选择具有偏移量的特定行

php - Symfony2 和 Doctrine - 插入时生成代码