在 WF4 中的工作流定义更改后加载持久工作流 [英] Loading persisted workflow after workflowdefinition has changed in WF4
问题描述
如何解决这个问题(在 WF4 中):
How to solve this problem (in WF4):
我在 xaml 中创建了一个工作流并启动了它的几个实例,我有一个持久性存储,并且所有工作流都在其工作流的一半保留在书签上.
I create a workflow in xaml and start several instances of it, I have a persistancestore and all workflows persist on a bookmark half way their workflow.
现在我停止应用
如果我重新启动 te 应用程序,一切都会恢复,很好地完成.
If I restart te application everything is resumed, en nicely completes.
但是如果我想在运行实例持续后更改工作流定义怎么办?加载正在运行的工作流(我能够找到)的唯一方法是以下方式:
But what if I want to change the workflow definition after the running instances persist? the only way to load the running workflows (that I was able to find) is the following way:
WorkflowApplication wfapp = new WorkflowApplication(new WorkflowDefinition());
wfapp.InstanceStore = new SqlWorkflowInstanceStore(connStr);
wfapp.Load(wfGuid);
所以你需要工作流定义,如果它在持久化过程中发生了变化,事情就会变得非常糟糕.
So you need the workflow definition, if it has changed during the persistance, things go horribly wrong.
解决这个问题的最佳方法是什么?
What is the best way to solve this?
推荐答案
这个场景有点问题.无法将旧工作流定义迁移到新格式.我已经做了一些有限的测试和一些场景,添加/删除尚未执行的活动.但后来我也遇到了严重错误的场景,包括重新执行一个已经完成的活动.
This scenario is a bit of a problem. There is no way to migrate am older workflow definition to the new format. I have done some limited testing and some scenarios with adding/deleting activities that where not yet executing worked fine. But then I also has scenarios go badly wrong, including re executing an already finished activity.
据我所知,除了跟踪用于创建工作流的 XAML/程序集版本并检查何时要重新启动工作流以确定要使用的工作流版本之外,没有其他好的方法可以解决该问题.
As far as I am aware there is no good way to solve the problem other than tracking the version of the XAML/assembly used to create the workflow and checking that when you want to restart a workflow to determine the workflow version to use.
这篇关于在 WF4 中的工作流定义更改后加载持久工作流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!