K
K
kid-programmer2015-04-13 16:03:58
ASP.NET
kid-programmer, 2015-04-13 16:03:58

How to remove project dependency from EntityFramework?

Hello!
There is an access layer with the given App.Data and an App.WebUI (MVC) presentation layer, the EntityFramework is used in the App.Data layer. Trying to use a class from App.Data where DbContext is used says:
" 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.."
as I understand it, you need to connect it to App.WebUI EntityFramework, but how to remove this dependency?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dordzhiev, 2015-04-13
@dordzhiev

Don't use Entity Framework. DbContext from EF.

C
csharper, 2015-04-14
@csharper

Why remove addiction? It is better to prescribe the necessary lines in the config.

<configSections>
<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="ConnectionName"
         connectionString="Server=serverName;Database=DataBaseName; User ID=UserName;Password=Password;" providerName="System.Data.SqlClient" />
</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>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question