【发布时间】:2013-11-27 14:31:01
【问题描述】:
[更新]
我的解决方案中有 2 个项目。第一个是我的 DAL 项目(类库),第二个是 Windows 项目(UI),我的 DAL 项目引用了 EF 4.3.1 并且工作正常,
最近我将我的 DAL 项目引用到 EF6,在 VS2010 中通过 Update-Package EntityFramework 命令使用包管理器控制台,在应用 EF official site 中的建议更改后,现在是 app.config我的 DAL 项目 包括以下几行:
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
和
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=MyServer;Initial Catalog=erptest;Persist Security Info=True;User ID=sa_l4;password=12212121;application name = LEVEL4" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
但是当我运行我的项目时,当控制来到下面一行时
var context = new MyDbContext();
我收到了这个错误:
No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.Odbc'. Make sure the provider is registered in the 'entityFramework' section of the application config file
有谁知道,问题出在哪里?
【问题讨论】:
标签: c# visual-studio-2010 entity-framework ef-code-first runtime-error