加载不同版本的同一总成

问题描述:

使用反射,我需要加载2不同版本的同一总成。我可以加载了2个版本的2个不同的AppDomain在同一个进程?

Using reflection, I need to load 2 different versions of the same assembly. Can I load the 2 versions in 2 different AppDomains in the same process?

我需要做一些数据迁移从旧版本的应用程序的新版本。 请让我知道这是可能的,或者我应该使用2个独立的进程。

I need to do some data migration from the old version of the app to the new version. Please let me know if this is possible or should I use 2 separate processes.

更新:我想我会后我发现作为一个答案。反思证明了开发工作而言过于复杂,跟踪当遇到类似的情况很长一段时间后,我记得做用2个不同的工艺不同的方式运行时错误等。(谢谢布兰登)。

UPDATE: I thought I will post my findings as an answer. Reflection proved too complex in terms of development effort, tracking run time errors etc. I remember doing a different approach using 2 different processes when faced with a similar situation long time back (Thank you Brandon).

这是该计划:没什么优雅,但在开发和故障排除方面更容易。由于它是一次性的工作,我们就必须使它发挥作用。

This is the plan: Nothing elegant but easier in terms of development and troubleshooting. Since it is a one time job, we just have to make it work.

主机远程处理过程(我称之为服务器),其应用程序的新版本。一个远程客户端的旧版本参考。

Host a remoting process (which i call the server) having the new version of the application. A remoting client has references for the older version.

远程客户端实例,并加载与迁移所需数据的对象。 转换旧的对象为普通序列化的对象,并作为参数传递给服务器。

Remoting client instantiates and loads the objects with data required for migration. Convert the old objects into common serializable objects and pass as parameters to the server.

远程服务器使用通用的数据实例化和加载新的对象。上调用新的类型的功能,以保持他们的数据。

Remoting Server uses the common data to instantiate and load the new objects. Invokes the functions on the new types to persist their data.