未找到具有不变名称“System.Data.SqlServerCe.4.0"的 ADO.NET 提供程序的实体框架提供程序 [英] No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'

查看:32
本文介绍了未找到具有不变名称“System.Data.SqlServerCe.4.0"的 ADO.NET 提供程序的实体框架提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将 sqlce 4.0 与 entityframework 6.0 一起使用时出现以下错误

I got the following error when I used sqlce 4.0 with entityframework 6.0

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'

我的 app.config 看起来像这样

My app.config looks like this

....
<configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false" />
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
 <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" >
      <parameters>
        <parameter value =" System.Data.SqlServerCe.4.0" />
      </parameters>
    </defaultConnectionFactory>
    <!--providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers-->
  </entityFramework>
  <connectionStrings>
    <add name="FbMultipleInsOrderContainer" connectionString="metadata=res://*/FbMultipleInsOrder.csdl|res://*/FbMultipleInsOrder.ssdl|res://*/FbMultipleInsOrder.msl;provider=System.Data.SqlServerCe.4.0;provider connection string=&quot;data source=|DataDirectory|FBMultipleOrderSync.sdf&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
...

我尝试重新安装 EF 6.但无济于事.

I tried re-installing EF 6. But no avail.

任何关于此的线索都将是非常可观的.

Any clue on this would be much appreciable.

推荐答案

安装EntityFramework.SqlServerCompact nuget 后包,检查您的 app.config 是否包含以下内容(根据上面@ErikEJ 的评论):

After installing the EntityFramework.SqlServerCompact nuget package, check that your app.config contains the following (as per @ErikEJ's comment above):

<providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
  <provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
</providers>

(您可以为 SqlClient 保留该行,即使您并不真正需要它.)

(You can leave the line for SqlClient even though you don't really need it.)

这篇关于未找到具有不变名称“System.Data.SqlServerCe.4.0"的 ADO.NET 提供程序的实体框架提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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