“没有实体框架提供程序找到”为EF 6和SQLite 1.0.96.0 [英] 'No Entity Framework provider found' for EF 6 and SQLite 1.0.96.0

查看:389
本文介绍了“没有实体框架提供程序找到”为EF 6和SQLite 1.0.96.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个主题已经有几个类似的问题,但是很多都是从旧版本的SQLite,我并不完全支持EF 6。我已经尝试过无数次的建议,这些线程,或者做错了事情或某事必须改变。



我正在使用VS 2013,针对.NET 4.5.1并已安装来自 system.data.sqlite.org下载页面,以及NuGet Manager(安装EF6)的System.Data.SQLite EF6软件包。



以下是我目前的App.config文件(除了我尝试将版本,文化和公钥变量添加到类型中,它几乎没有改变):

 <?xml version =1.0encoding =utf-8?> 
< configuration>
< configSections>
<! - 有关实体框架配置的更多信息,请访问http://go.microsoft.com/fwlink/?LinkID=237468 - >
< section name =entityFrameworktype =System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089requirePermission =false/> ;
< / configSections>
< startup>
< supportedRuntime version =v4.0sku =。NETFramework,Version = v4.5.1/>
< / startup>
< entityFramework>
< defaultConnectionFactory type =System.Data.Entity.Infrastructure.LocalDbConnectionFactory,EntityFramework>
< parameters>
< parameter value =mssqllocaldb/>
< / parameters>
< / defaultConnectionFactory>
< providers>
< provider invariantName =System.Data.SqlClienttype =System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer/>
< provider invariantName =System.Data.SQLite.EF6type =System.Data.SQLite.EF6.SQLiteProviderServices,System.Data.SQLite.EF6,Version = 1.0.96.0,Culture = neutral,PublicKeyToken = db937bc2d44ff139/>
< / providers>
< / entityFramework>
< system.data>
< DbProviderFactories>
< remove invariant =System.Data.SQLite.EF6/>
< add name =SQLite数据提供程序(实体框架6)invariant =System.Data.SQLite.EF6description =.NET Framework Data Provider for SQLite(Entity Framework 6)type =System .Data.SQLite.EF6.SQLiteProviderFactory,System.Data.SQLite.EF6,Version = 1.0.96.0,Culture = neutral,PublicKeyToken = db937bc2d44ff139
/>
< / DbProviderFactories>
< /system.data>
< / configuration>

我的packages.config:

 <?xml version =1.0encoding =utf-8?> 
< packages>
< package id =EntityFrameworkversion =6.1.2targetFramework =net451/>
< package id =System.Data.SQLite.EF6version =1.0.96.0targetFramework =net451/>
< / packages>

如果我尝试从模型生成数据库,会看到以下错误:找不到具有
不变名称'System.Data.SQLite.EF6'的ADO.NET提供程序的实体框架提供程序。确保提供者已注册在entityFramework部分...


我已经尝试围绕App.config文件并添加其他提供商和提供商作为旧线程已经建议但无济于事。



如何解决这个问题?任何帮助是非常感谢!



编辑:我设法使其运行良好,以使用数据库第一种方法。以下是我的App.config文件的相关部分:

 < providers> 
< provider invariantName =System.Data.SQLite.EF6type =System.Data.SQLite.EF6.SQLiteProviderServices,System.Data.SQLite.EF6/>
< / providers>

< DbProviderFactories>
< remove invariant =System.Data.SQLite/>
< remove invariant =System.Data.SQLite.EF6/>
< add name =SQLite数据提供程序(实体框架6)invariant =System.Data.SQLite.EF6description =.NET Framework Data Provider for SQLite(Entity Framework 6)type =System .Data.SQLite.EF6.SQLiteProviderFactory,System.Data.SQLite.EF6/>
< add name =SQLite数据提供者invariant =System.Data.SQLitedescription =.NET Framework Data Provider for SQLitetype =System.Data.SQLite.SQLiteFactory,System.Data.SQLite />
< / DbProviderFactories>

我使用的是EF 6.1.2和System.Data.SQLite 1.0.96.0。 >

解决方案

我只是在App.config中添加一行来解决同样的错误

 < provider invariantName =System.Data.SQLitetype =System.Data.SQLite.EF6.SQLiteProviderServices,System.Data.SQLite.EF6/> 


I realize there are already several similar questions on this topic, but many of them are from older version of SQLite which did not fully support EF 6 as far as I am aware. I have tried countless suggestions from these threads and am either doing something wrong or something must have changed.

I am using VS 2013, targeting .NET 4.5.1 and have installed the sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe package from the system.data.sqlite.org download page, as well as the System.Data.SQLite EF6 package from the NuGet Manager (which installs EF6).

Below is my current App.config file (it is pretty much untouched except I tried adding the Version, Culture, and Public key variables to the type):

<?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="mssqllocaldb" />
      </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, Version=1.0.96.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </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, Version=1.0.96.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"
      />
    </DbProviderFactories>
  </system.data>
</configuration>

And my packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.1.2" targetFramework="net451" />
  <package id="System.Data.SQLite.EF6" version="1.0.96.0" targetFramework="net451" />
</packages>

If I do something such as attempt to Generate a Database from Model I see the following error:

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SQLite.EF6'. Make sure the provider is registered in the 'entityFramework' section...

I've tried messing around the the App.config file and adding other providers and providers as old threads have suggested but to no avail.

How do I fix this problem? Any help is greatly appreciated!

Edit: I managed to get it to work well enough to use a database first approach. Here is the relevant parts of my App.config file:

<providers>
     <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>

<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" />
     <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>

I'm using EF 6.1.2 and System.Data.SQLite 1.0.96.0.

解决方案

I solved same error with just add a single line in App.config

<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>

这篇关于“没有实体框架提供程序找到”为EF 6和SQLite 1.0.96.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆