Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.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' 

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

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

Any clue on this would be much appreciable.

like image 207
kuhajeyan Avatar asked Nov 06 '13 19:11

kuhajeyan


People also ask

Where is the Entity Framework provider for ADO?

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

Where can I find the Entity Framework provider for mysqlclient?

No Entity Framework provider found for 'MySql.Data.MySqlClient' ADO.NET provider. Make sure the provider is registered in the 'entityFramework' section of the application config file.

Why am I getting “Entity Framework cannot be used” error in Salesforce?

This error occurs because the project code tries to use Entity Framework while no reference has been made to Entity Framework in the project. To resolve this error, we need to add reference to “Entity Framework” to the project.

What is the error message of Entity Framework error 0152?

The error message is as below: Schema specified is not valid. Errors: "XYZ.ssdl (2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’". Make sure the provider is registered in the ‘EntityFramework’ section of the application config file.


1 Answers

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> 

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

like image 107
Olly Avatar answered Oct 21 '22 13:10

Olly