我该如何使用工作流程活动库中(重新托管)工作流设计器旧版本? [英] How can I use workflows with older versions of activity libraries in (rehosted) workflow designer?

查看:126
本文介绍了我该如何使用工作流程活动库中(重新托管)工作流设计器旧版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的是重新托管工作流设计器在ASP.NET应用程序生成的工作流程的图像,基本上采用WorkflowMonitor样品中像<一个类似的方式href="http://www.masteringbiztalk.com/blogs/jon/PermaLink,guid,79f45d4d-6e5a-437b-a230-d7df13ae18e7.aspx"相对=nofollow>阿特拉斯工作流程监控。现在我已经开始担心重新部署后,该解决方案的行为时,已安装的库版本不再与旧工作流程定义(特别是从数据库中跟踪工作流程和历史条目原来包含有工作流的XOMLs在过去的执行)。有一件事值得一提的是,我已阅读<一个href="http://msmvps.com/blogs/theproblemsolver/archive/2008/09/10/versioning-long-running-workfows.aspx"相对=nofollow>文章有关使用多个版本的工作流程,同时,这不正是我需要的,因为我真的不希望运行与旧的定义工作流,我只是想展示自己的图。我刚才看到2解决方案:

I used the rehosted workflow designer in an ASP.NET application to generate images of workflows, basically adopting the WorkflowMonitor sample in a similar way like the Atlas Workflow Monitor. Now I have started to worry about the behavior of this solution after redeployment when the installed version of the libraries no longer match the original one from old workflow definitions (especially from tracked workflows and history entries within the database that contains the XOMLs of workflows that were executed in the past). One thing worth noting is that I have read the article about using multiple versions of workflows at the same time and this is not exactly what I need as I don't really want to run the workflows with old definitions, I just want to show their diagrams. I saw just 2 solutions :

  1. 以从工作流设计器的截图在当工作流完成/终止,在这里我还是有库的实际版本,只是将其保存为一个位图到数据库的时间。
  2. 在保持老版本库在一个单独的文件夹只是为了能够以某种方式它们加载到设计使其仍然可以生成从旧的工作流程图表,即使在他们的活动不再在当前程序集版本。

至于我想避免浪费空间(溶液1),我决定先尝试解决方案2.我发现使用了WorkflowMarkupSerializer或WorkflowDesignSurface的TypeProvider服务的一些例子,并试图使用它们。不幸的是,在一项活动是在一个新的库中删除与旧库装入该TypeProvider的情况下,似乎没有工作,如果直接使用WorkflowMarkupSerializer的阅读XOML它只是排除了缺失的活动从图用SqlTrackingService时加载它抛出一个异常,该活动的类型缺失(尽管内部似乎使用WorkflowMarkupSerializer同样的方法)一些老的被跟踪的实例。

As I wanted to avoid wasting space (solution 1), I decided to first try the solution 2. I have found some examples using the TypeProvider service for the WorkflowMarkupSerializer or the WorkflowDesignSurface and tried to use them. Unfortunately, in the scenario where an activity is removed in a newer library and the old library is loaded with this TypeProvider, doesn't seem to work, in case of direct use of WorkflowMarkupSerializer to read the XOML it simply excludes the missing activity from diagram, when using SqlTrackingService to load some old tracked instances it throws an exception that the type of the activity is missing (although internally it seems to use the same method of WorkflowMarkupSerializer).

你有这个或提示如何TypeProvider应该用什么可能出问题的一些经验?感谢;)

Do you have some experiences with this or tips how the TypeProvider should be used what could possibly go wrong ? Thanks ;)

推荐答案

原来的TypeProviders不是一个可靠的方法来解决缺少的工作流渲染(和访问老活动等跟踪信息集引用)。现在的问题是,不仅他们不为SqlTrackingService工作,也即要能够装配传递到它必须被加载到应用程序域的TypeProvider。有多个版本的应用程序域相同的组件会导致疯狂的事情发生,所以这是绝对必要的,以避免它。

It turned out that the TypeProviders are not a reliable way to resolve assembly references that are missing for the workflow rendering (and accessing the tracking information for old activities etc.). The problem is not only that they don't work for SqlTrackingService, but also that to be able to pass an assembly into the TypeProvider it has to be loaded into the AppDomain. Having multiple versions of the same assembly in the AppDomain causes crazy things to happen, so it was absolutely necessary to avoid it.

虽然它不可能从一个AppDomain卸载程序集一旦它​​被加载时,它可以创建一个独立的AppDomain它加载组件的旧版本需要(当我做这个注册到的的AssemblyResolve事件AppDomain中),然后简单地卸载整个AppDomain中,当工作完成。例如如何可以做到这一点看到相关<一href="http://stackoverflow.com/questions/2100296/how-can-i-switch-net-assembly-for-execution-of-one-method">question.

Although it is not possible to unload an assembly from an AppDomain once it's been loaded, it is possible to create an isolated AppDomain which loads the older version of assemblies when necessary (I've done this registering to the AssemblyResolve event of the AppDomain) and then simply unload the whole AppDomain when the work is done. For example of how this can be done see related question.

现在,我高兴地呈现出不同版本的活性库图没有任何问题;)

Now I'm happily showing diagrams from different versions of activity libraries without any problems ;)

这篇关于我该如何使用工作流程活动库中(重新托管)工作流设计器旧版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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