【发布时间】:2014-04-16 15:55:38
【问题描述】:
我有以下 MVC 项目结构:
BLL
DAL
通用类
网络
我正在使用实体框架 6.0.2。 Web 项目引用了 BLL 和 CommonClasses 项目。 BLL 引用了 DAL 和 CommonClasses。 BLL 和 DAL 也都引用了通过 Nuget 添加的 EF 6.0.2。每当我的代码尝试使用 Entity Framework 做任何事情时,我都会收到以下错误:
找不到具有不变名称“System.Data.SqlClient”的 ADO.NET 提供程序的实体框架提供程序。确保提供程序已在应用程序配置文件的“entityFramework”部分注册。
我对正在发生的事情有点迷茫。我检查过,在 DAL 和 BLL 项目中有对 EntityFramework.SqlServer 的引用。所有项目也都有对 System.Data 的引用。
DAL 和 BLL 项目中的 app.config 文件具有以下行:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
【问题讨论】:
标签: c# asp.net asp.net-mvc entity-framework