Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hello i have some problems to implementing class library that hold the edmx entity

i have in my solution 2 project :
1)console application
2) class library ("modelsLayer")

in the class library i created an edmx entity using wizard

1) i add to the console app reference to "modelsLayer".
2)add the entity reference by dong browse to the dll at the "modelsLayer"
(to get the same version instead add entity framework from nuget)

3)and copy the connection section from "modelsLayer" into the console application config.

and then i got this exception :

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


This is the class library app.config


 <?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="MyDbEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=LIOR-PC\SQLEXPRESS;initial catalog=MyDb;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>


i search for any answers end check the and still it is not work for me



Please help :(

Posted
Updated 8-Jul-15 10:59am
v2

1 solution

I think you used old version. I managed to fix it by running the following command on Package Manager Console:

PM> Install-Package EntityFramework

And if comand not work then download NuGet Package Manager and install it using this link NuGet Package Manager

And then try it it's work.
 
Share this answer
 
Comments
Member 10631195 9-Jul-15 5:15am    
i dit the update entity framework from the nuget comment and still i have this problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900