工作流基础 4.0 使用参数加载工作流

发布于 2024-12-01 03:38:40 字数 620 浏览 3 评论 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月野兔 2024-12-08 03:38:40

首先,您需要创建一个创建书签的活动。然后,您必须运行工作流,直到它空闲下来等待该书签。

然后,您按照已完成的方式加载工作流程,并按照

var result = application.ResumeBookmark(bookmarkName, data);

一定要检查结果以确保其恢复正常。 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

var result = application.ResumeBookmark(bookmarkName, data);

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.Activ​ities.UnitTesti​ng - How do I test an activity with bookmarks?

浮萍、无处依 2024-12-08 03:38:40

仅当您的批准是不可变类型时,这种传递参数的方式才有效。使用字典适用于所有输入类型。有关详细信息,请参阅此处

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文