实体框架5和6中相同的应用程序 [英] Entity Framework 5 and 6 in the same application

查看:140
本文介绍了实体框架5和6中相同的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在同一个项目中使用不同版本的实体框架?
我有两个器件的应用:
- 酮EF5
- 和第二,EF6和参考的第一个项目(那些一个用EF5)

I want to use different version of Entity Framework in the same project.? I have two appication: -one with EF5 -and the second with EF6 and reference to first project(those one with ef5)

现在我想使用的方法从第二个的第一个。
但是....

Now i want to use methods from the first one in the second one. But....

我有问题,这一点,因为当我运行应用程序EF5方法,它说:

i have problems, with this ,cause when i run method from ef5 app, it says that :


无法加载文件或程序集的EntityFramework,版本5.0.0.0 =文化=中性公钥= b77a5c561934e089或它的一个依赖。位于集清单定义不匹配的程序集引用。 (异常来自HRESULT:0x80131040)

Could not load file or assembly 'EntityFramework, Version = 5.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089' or one of its dependencies. Located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

如何使用不同版本的EF DLL中同一个项目?

How to use different version of EF dll in the same project?

suggesions?感谢名单。

suggesions?Thanx.

推荐答案

您不能加载同一程序集的多个版本为单个应用程序域。 .NET框架不支持它。您必须使用:

You cannot load multiple versions of the same assembly into single Application domain. .NET Framework does not support it. You must either use:


  • 使用两个应用程序EF的单一版本 - 这应该是如果你需要走正道在第二个

  • 使用EF相关的代码从第一个应用程序重构第一应用和移动需要重用成单独的程序不依赖于EF所有的方法 - 这应该是正确的方式去如果你可以从抽象的EF代码

  • 从单独的应用程序域中的第一个应用程序执行代码 - 不使用这种方法。它就像运行在一个窗口过程中的两个.NET流程。您必须使用进程间通信来传递两个应用程序域之间的数据。

通常也有约束力重定向选项,但我恐怕也不会在这种情况下工作,因为EF6带来了太多的重大更改。

Normally there is also option for binding redirects but I'm afraid it will not work in this case because EF6 brings too many breaking changes.

这篇关于实体框架5和6中相同的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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