繁体   English   中英

带有实体框架的SQLite:VS2013中没有可用的SQLite数据提供程序

[英]SQLite with Entity Framework : no data provider for SQLite available in VS2013

关于此主题,关于Stackoverflow有很多问题。 我尝试了大多数建议的答案,但没有一个对我有用。

  • 我的设置:Win 7 32位+ VS2013 Update 5
  • 我安装了sqlite-netFx46-setup-bundle-x86-2015-1.0.108.0.exe (完整安装)
  • 然后,我创建了一个新的.NET 4.6控制台项目
  • 然后我安装了SQLite Nuget软件包
  • 此外,我在AnyCPU中构建了项目,然后在x86中进行了另一次尝试
  • 然后我尝试添加实体数据模型(添加->新项目-> ADO.NET实体数据模型)

无论我选择哪个选项(EF Designer,代码优先),当我尝试创建连接时,都看不到SQlite的提供程序。

我的配置文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <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.6" />
    </startup>
    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
            <parameters>
                <parameter value="v11.0" />
            </parameters>
        </defaultConnectionFactory>
        <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" />
            <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>

我的软件包配置:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.0.0" targetFramework="net46" />
  <package id="System.Data.SQLite" version="1.0.108.0" targetFramework="net46" />
  <package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net46" />
  <package id="System.Data.SQLite.EF6" version="1.0.108.0" targetFramework="net46" />
  <package id="System.Data.SQLite.Linq" version="1.0.108.0" targetFramework="net46" />
</packages>

编辑:添加屏幕截图以澄清问题:

在那里我应该能够设置到我的SQLite DB的连接

我做错了什么 ? 谢谢你的帮助 !

好的,我只是想知道发生了什么事。 我只是没有安装适当的提供程序。 我应该安装sqlite-netFx451-setup-bundle-x86-2013-1.0.108.0.exe

在System.Data.SQLite Wiki中不是很清楚,但是文件名中的年份不是我想象的发布日期,而是VisualStudio版本。 我的错误是通过所需的目标.NET版本选择提供程序。

安装正确的提供程序后,即使提供程序的目标是.NET 4.5.1,而我的项目的目标是.NET 4.6,也可以正常进行所有工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM