none
How do I specify the correct entityFramework provider in web.config

    Question

  • I'm having a Package Error after switching connection string from SQL Server to to Compact SQL Server (trying out VS 2013 prerelease with CodeFirst EF 6.0 and compatible compact SQL). 

    Here is my first error (using the below packages & web.config). After adding what I thought was the provider to my webconfig; I'm now getting the second error below. I'm not sure if I'm specifying correct packages or versions. Thanks for your help.


    Error:   No Entity Framework provider found for 'System.Data.SqlServerCe.4.0' ADO.NET provider. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.



     Packages:

      EntityFramework.SqlServer.dll 
        Runtime Version  v4.0.30319        Version 6.0.0.0
      Microsoft.AspNet.Identity.EntityFramework
        v4.0.30319         1.0.0.0
      System.Data.SqlServerCe
        v2.0.50727          4.0.0.0
      System.Data.SqlServerCe.Entity
        v4.0.30319          4.0.0.0

    Web.config:
      <entityFramework>
        < defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
          < parameters>
            < parameter value =" System.Data.SqlServerCe.4.0" />
          </ parameters>
        </ defaultConnectionFactory>
      </entityFramework>
      <system.data>
        < DbProviderFactories>
          < remove invariant =" System.Data.SqlServerCe.4.0" />
          < add name =" Microsoft SQL Server Compact Data Provider 4.0 " invariant="System.Data.SqlServerCe.4.0" description= ".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
        </ DbProviderFactories>

      </system.data>


    Added to Web.config:

        <providers>
          <provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        </providers>

    New Error:   The Entity Framework provider type 'System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' for the 'System.Data.SqlServerCe.4.0' ADO.NET provider could not be loaded. Make sure the provider assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.


    bill jenner

    Sunday, July 21, 2013 3:35 PM

Answers

  • I was able to resolve my own issue. Just created a new clean project, installed  EntityFramework.SqlServerCompact 6.0.0-beta1 and dependencies first thing. After that I was able to migrate my custom code changes and now life is good. Not sure of all the differences between the old & new project but staring clean definitely helped.

    bill jenner

    • Marked as answer by billjenner Sunday, July 21, 2013 5:59 PM
    Sunday, July 21, 2013 5:59 PM

All replies

  • I was able to resolve my own issue. Just created a new clean project, installed  EntityFramework.SqlServerCompact 6.0.0-beta1 and dependencies first thing. After that I was able to migrate my custom code changes and now life is good. Not sure of all the differences between the old & new project but staring clean definitely helped.

    bill jenner

    • Marked as answer by billjenner Sunday, July 21, 2013 5:59 PM
    Sunday, July 21, 2013 5:59 PM
  • Hi, That helps me but It is not necesary create a new project.

    Only open Nutget package console and install the EntityFramework.SqlServerCompact.

    I hope that helps another one.

    Saturday, November 16, 2013 12:41 PM