0

I have updated my project from EF5 to EF6, using NuGet, but am getting an error now as soon as my application tried to query the database.

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. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

I think the issue is with my data project's App.Config, which resembles this:

<?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>
  <connectionStrings>
    <add name="AccuFinanceEntities" connectionString="metadata=res://*/AccuFinanceEntities.csdl|res://*/AccuFinanceEntities.ssdl|res://*/AccuFinanceEntities.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=laptop;initial catalog=mydb;Integrated Security=True;MultipleActiveResultSets=True;App=AccuFinance&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <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" />
    </providers>
  </entityFramework>
</configuration>

My web.config only has a connection string applied:

<connectionStrings>
    <!--SERVER -->
    <!--LOCAL-->
    <add name="AccuFinanceEntities" connectionString="metadata=res://*/AccuFinanceEntities.csdl|res://*/AccuFinanceEntities.ssdl|res://*/AccuFinanceEntities.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=laptop;initial catalog=mydb;Integrated Security=True;MultipleActiveResultSets=True;App=AccuFinance&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

I think I need to add or remove something from one of these, but not sure which. It worked fine under EF5. Project compiles and builds, and I can edit my EDMX file (I can update model from database).

What am I doing wrong?

Craig
  • 18,074
  • 38
  • 147
  • 248
  • Did you get EF5 by NuGet ? If you want to know that package installed properly run this command in your [PowerShell](http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference) . – Aria Jan 21 '15 at 11:44
  • Yeah, EF5 was added by NuGet. I am able to remove EF5 with NuGet, and update to 6. But after the update, I get a lot of errors. Another issue I see is that 'Context.SaveChanges()' used to work, but now 'SaveChanges' is an unknown method. – Craig Jan 21 '15 at 19:58
  • Is your project includes EntityFramework.SqlServer.dll, have you read this http://stackoverflow.com/questions/18455747/no-entity-framework-provider-found-for-the-ado-net-provider-with-invariant-name – Aria Jan 22 '15 at 18:02
  • Will read that. Hopefully it's the resolution. – Craig Jan 23 '15 at 01:42

0 Answers0