为什么我的项目中有EntityFramework和System.Data.Entity程序集? [英] Why there are both EntityFramework and System.Data.Entity assemblies in my project?

查看:456
本文介绍了为什么我的项目中有EntityFramework和System.Data.Entity程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚打开了VS 2012,并创建了一个类库项目。之后,我向我的解决方案添加了一个新的 ADO.NET实体数据模型

I just opened VS 2012 and created a class library project. After that I added a new ADO.NET Entity Data Model item to my solution.

我注意到有两个一个名为EntityFramework 5.0的程序集,另一个名为System.Data.Entity 4.0的程序集。不应该只是一个?

I noticed there are both an assembly called EntityFramework 5.0 and another one called System.Data.Entity 4.0. Shouldn't it be just one?

作为一个奖金问题,当我点击设计器崩溃的文件:

As a bonus problem, when I click the file the designer crashes:

Error   2   Error 6039: warning CS1701: Assuming assembly reference 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' matches 'System.Data.Entity, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', you may need to supply runtime policy
c:\Users\andre_pena\AppData\Local\Temp\5srvr0ge.0.cs(465,29) : error CS1061: 'System.Data.Metadata.Edm.EdmFunction' does not contain a definition for 'IsComposableAttribute' and no extension method 'IsComposableAttribute' accepting a first argument of type 'System.Data.Metadata.Edm.EdmFunction' could be found (are you missing a using directive or an assembly reference?)    c:\users\andre_pena\documents\visual studio 2012\Projects\ClassLibrary2\ClassLibrary2\Model1.edmx   1   1   ClassLibrary2

我的系统是否一切正常?两个文件的存在是否正常?为什么我得到这个错误?

Is it everything ok with my system? Is the existence of both files normal? Why am I getting this error?

推荐答案

你应该有两个程序集:

EntityFramework.dll (具有DbContext API,代码优先)

EntityFramework.dll (has DbContext API, Code First)

System.Data.Entity.dll (拥有ObjectContext和DbContext API,新功能)

System.Data.Entity.dll (has ObjectContext and DbContext APIs, new features)

需要两个程序集是允许实体框架团队发布更新,而无需等待下一次正式发布。 NET框架。

The need for two assemblies are to allow the Entity Framework team to release updates without waiting for the next official release of the .NET Framework.

.NET 4.5中支持EdmFunction.IsComposableAttribute ,因此请检查
System.Data.Entity.dll

请在这里查看详细答案: https: //stackoverflow.com/a/9694963/1241400

And check the detailed answer here: https://stackoverflow.com/a/9694963/1241400

提示:

如果你想使用lambda与 Include() System.Data.Entity 添加using指令。

If you want to use lambda with Include() add a using directive for System.Data.Entity .

这篇关于为什么我的项目中有EntityFramework和System.Data.Entity程序集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆