工作流基础 4.0 使用参数加载工作流
WF 4.0 SP1
我们正在尝试加载工作流程并根据用户操作进行状态遍历。因此,当用户说批准时,我们会通过如下所示的内容:
var activity = new StateMachineApprovalFlow();
WorkflowApplication application = new WorkflowApplication(activity);
var approval = new Approval();
approval.Status = ApprovalStatus.Completed;
activity.Approval = approval;
SetupInstanceStore();
application.InstanceStore = store;
application.Extensions.Add(new OracleTrackingParticipant());
application.Load(instanceId);
这会破坏。首先这是正确的方法还是我应该使用书签。我对工作流程非常陌生,所以例子会有所帮助。
谢谢
WF 4.0 with SP1
We are trying to load workflow and do state traversal based on users actions. So say when user say approve we pass something like below:
var activity = new StateMachineApprovalFlow();
WorkflowApplication application = new WorkflowApplication(activity);
var approval = new Approval();
approval.Status = ApprovalStatus.Completed;
activity.Approval = approval;
SetupInstanceStore();
application.InstanceStore = store;
application.Extensions.Add(new OracleTrackingParticipant());
application.Load(instanceId);
This breaks.First is this the right way or should i use bookmark. i am very new to workflow so example will help.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您需要创建一个创建书签的活动。然后,您必须运行工作流,直到它空闲下来等待该书签。
然后,您按照已完成的方式加载工作流程,并按照
一定要检查结果以确保其恢复正常。 Microsoft.Activities(在 CodePlex 上提供)有一些扩展方法可以使这变得更容易。有关示例,请参阅Microsoft.Activities.UnitTesting - 如何使用书签测试活动?
First you need to create an activity which creates a bookmark. Then you must run the workflow until it becomes idle waiting for that bookmark.
Then, you load the workflow as you have done and follow that by
Be sure to check the result to see that it resumed ok. Microsoft.Activities (available on CodePlex) has some extension methods to make this easier as well. For a sample see Microsoft.Activities.UnitTesting - How do I test an activity with bookmarks?
仅当您的批准是不可变类型时,这种传递参数的方式才有效。使用字典适用于所有输入类型。有关详细信息,请参阅此处。
This way of passing parameters only works if your Approvals is an immutable type. Using a Dictionary works with all input types. See here for more details.