EntityFramework.dll 与 System.Data.Entity.dll — 歧义
我想知道 EntityFramework.dll 和 System.Data.Entity.dll 有什么共同点和不同点?我的项目引用 System.Data.Entity.dll (June CTP) 来利用代码优先模型,一切正常。
现在我希望使用 Code First Migrations 工具,它需要 EntityFramework.dll,我也必须将其添加到我的项目中。但是,当引用两个库(EntityFramework.dll 和 System.Data.Entity.dll)时,我收到很多编译器错误,认为某些类是在两个库中定义的。
当我删除 EntityFramework.dll 时,该项目会再次编译,但我无法使用迁移。当仅引用 EntityFramework.dll 时,我收到编译器错误,告诉我找不到某些类(例如空间数据类型)。
在这种情况下我该怎么办?先感谢您!
I wonder what EntityFramework.dll and System.Data.Entity.dll have in common and what they have different? My project references System.Data.Entity.dll (June CTP) to leverage code first model and everything works fine.
Now I wish to use Code First Migrations tool, and it requires EntityFramework.dll that I also have to add to my project. However, when both libraries (EntityFramework.dll and System.Data.Entity.dll) are referenced, I get a lot of compiler errors arguing that some classed are defined in both libraries.
When I remove EntityFramework.dll, the project does compile again but I cannot use Migrations. When only EntityFramework.dll is referenced, I get complier errors telling me that some classes are not found (e.g. Spatial datatype).
What should I do in this situation? Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
System.Data.Entity.dll 版本“4.2.0.0”(CTP 2011 年 6 月)包含 EFv4.0 和 EFv4.1 的所有内容 = ObjectContext API 和 DbContext API + 新功能,但它可能是很长一段时间以来唯一一个版本会将这两个 API 组合在同一个程序集中。这个CTP已经死了。新的核心功能将转移到 .NET 4.5,DbContext API 仍将作为包含 EntityFramework.dll 的单独 NuGet 包提供。一切都被描述这里。
代码迁移依赖于 EFv4.1 Update 1 及其 EntityFramework.dll。它们与 June CTP 不兼容,并且在其安装说明或 先决条件 = 您不能将它们与 June CTP 一起使用。
System.Data.Entity.dll version "4.2.0.0" (June CTP 2011) contains everything from EFv4.0 and EFv4.1 = both ObjectContext API and DbContext API + new features but it is probably the only version for a long time which will combine these two APIs in the same assembly. This CTP is dead. The new core features will be moved to .NET 4.5 and DbContext API will be still shipped as separate NuGet package containing EntityFramework.dll. Everything is described here.
Code migrations are dependent on EFv4.1 Update 1 and its EntityFramework.dll. They are not compatible with June CTP and it is directly described in their installation notes or prerequisites = you cannot use them with June CTP.