【发布时间】:2018-08-09 17:18:23
【问题描述】:
Stackoverflow 上有很多关于这个主题的问题。我尝试了大多数建议的答案,但没有一个对我有用。
- 我的设置:Win 7 32 位 + VS2013 更新 5
- 我安装了
sqlite-netFx46-setup-bundle-x86-2015-1.0.108.0.exe(完全安装) - 然后我创建了一个新的 .NET 4.6 控制台项目
- 然后我安装了 SQLite Nuget 包
- 另外,我在 AnyCPU 中构建了我的项目,并在 x86 中进行了另一次尝试
- 然后我尝试添加实体数据模型(Add -> New Items -> ADO.NET Entity Data Model)
无论我选择什么选项(EF 设计器,代码优先),当我尝试创建连接时,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 提供者" - 在哪里可见?你在看什么?
-
这是我的问题,但可能需要更多说明。我用屏幕截图编辑了问题。
标签: c# entity-framework sqlite visual-studio-2013 system.data.sqlite