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

c#-4.0 entity-framework sql-server-ce

Question

When I combined SQLCE 4.0 with EntityFramework 6.0, I received the following error.

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

This is how my app.config looks.

....
<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>
...

I attempted to reinstall EF 6. but in vain.

Any information on this would be greatly appreciated.

1
35
11/6/2013 7:42:22 PM

Accepted Answer

Check that your app.config contains the following after installing the EntityFramework.SqlServerCompact nuget package (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>

(You don't actually need the line for SqlClient, but you can leave it.)

57
6/13/2014 12:46:42 PM

Popular Answer

ErikEJ has already brought this up, but I want to emphasize that you really MUST install the Nuget package.

EntityFramework.SqlServerCompact

I attempted to implement the suggested solution but failed since I was missing the NuGet package that the App.config was referring.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow