I have 2 projects: class library(as DAL layer) and ASP.NET MVC project(as UI). For getting data I try to use EF6, but it doesn't work. All the exception text:
An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code
Additional information: 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.
In DAL app.config I have this:
<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>
EF generates connection string with sqexpress provider:
Data Source=.\SQLEXPRESS;Initial Catalog=DAL.Entity.DataContext;Integrated Security=True;MultipleActiveResultSets=True
P.S. Please, help, I'm going to hate this damn thing.
EntityFramework
section as well as theConnectionString
setting. – Tommy