使用 Microsoft WF 序列化版本化工作流程
我有一个简单的业务工作流程,具有以下条件
- 用户需要使用设计者更改工作流程本身
- 该工作流程是一个长时间冲洗的工作流程,因此它将被序列化
有没有办法自动执行不同工作流程组件版本控制的任务?
I have a simple business workflow with the following conditions
- Users need to change the workflow itself using a desinger
- The workflow is a long rinning workflow, so it will be serialized
Is there a way to automate the task of versioning different workflow assemblies?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在自己的应用程序中重新托管 WF 设计器,以便最终用户更改工作流程。 当您接待设计师时,您几乎可以控制他们可以做什么。 例如,您可以阻止他们删除或禁用活动,只允许他们在工作流的预定义区域中添加特定的新活动。 最好的方法是将这些工作流程保存为 XOML 文件并以此方式启动它们。 这确实意味着您无法将代码添加到工作流本身,但您可以自由定义从 SequentialWorkflowActivity (或等效状态)派生的工作流基类并将其用作工作流基类。 这允许您添加代码和属性。 例如,您仍然可以添加 CodeActivity,但需要链接到基类中的代码。
工作流序列化(或称为脱水)与正在运行的工作流一起使用,以将其持久保存到磁盘。 这使用标准的 .NET 二进制序列化,并且由于工作流的长时间运行性质,可能会很棘手。 但一旦你知道要寻找什么,那就没什么大不了的了。 请参阅 http://msmvps.com /blogs/theproblemsolver/archive/2008/09/10/versioning-long-running-workfows.aspx 作为一系列博客文章的开始。
不确定您是否需要它,但还可以更改已经执行的工作流程。 这使用 WorkflowChanges 对象。 请参阅此处 http://wiki.windowsworkflowfoundation.eu/default.aspx/WF/ RuntimeModificationOfWorkflows.html 了解更多详细信息。
You can rehost the WF designer in your own application to let the end users change workflows. As you are hosting the designer you pretty much control what they can do. For example you can prevent them from removing or disabling activities and only allow them to add specific new activities in predefined area's of the workflow. The best approach is to save these workflows as XOML files and start them as such. This does mean you cannot add code to the workflow itself but you are free to define your workflow base class derived from SequentialWorkflowActivity (or the state equivalent) and use that as the workflow base class. This allows you to add code and properties. For example you can still add a CodeActivity but you need to link to code in the base class.
Workflow serialization, or dehydration as it is called, is used with running workflows to persist them to disk. This uses standard .NET binary serialization and can be a but tricky due to the long running nature of workflows. But no big deal once you know what to look for. See http://msmvps.com/blogs/theproblemsolver/archive/2008/09/10/versioning-long-running-workfows.aspx for the start of a series of blog posts.
Not sure if you need it but there is also the capability to change already executing workflows. This uses the WorkflowChanges object. See here http://wiki.windowsworkflowfoundation.eu/default.aspx/WF/RuntimeModificationOfWorkflows.html for more details.
这是另一篇关于工作流版本控制的文章:
http://www.adefwebserver.com/DotNetNukeHELP/ Workflow/VacationRequest3.htm
基本上,您可以对使用程序集的工作流程进行版本控制,如果:
必须是强名。
使用接口也必须强大
命名并放置在单独的
集会。
可以指示 asp.net 在哪里找到
正确的组装。
Here is another article on workflow versioning:
http://www.adefwebserver.com/DotNetNukeHELP/Workflow/VacationRequest3.htm
Basically you can version workflows that use assemblies if:
must be strong named.
uses an interface it also must be strong
named and placed in a separate
assembly.
can instruct asp.net where to find
the proper assembly.
不同工作流程序集的版本控制并不是一项简单的任务,并且有很多复杂性。 在这里您可以找到一系列专门讨论此问题的帖子。
The versioning of different workflow assemblies is not a trivial task and has a lot of complications. Here you can find a series of posts that deal exactly with this.