windows工作流程图和异常处理

发布于 2024-09-15 12:23:36 字数 72 浏览 4 评论 0原文

假设我有一个包含接收、自定义代码活动和发送回复的流程图 自定义代码活动引发异常。如何返回接收活动?

有什么想法吗?

Supose that I have a flowchat with a receive, custom code activity and sendreply and
the custom code activity throws an exceptions. How can I return to the receive activity?

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

冷月断魂刀 2024-09-22 12:23:36

您可以使用“While”活动作为重试的方法 - 如果出现异常。

alt text

包含此示例更多详细信息的整篇文章位于 此处

You could use the "While" activity as a means of retrying - should there be an exception.

alt text

The entire article with more details for this sample is here

浪荡不羁 2024-09-22 12:23:36

我使用 wf4 以与文章类似的方式创建了自定义活动,它是这样的:

public sealed class Retry : NativeActivity {

    public Activity Body { get; set; }

    protected override void Execute(NativeActivityContext context) {
        context.ScheduleActivity(Body, OnBodyCompleted, OnBodyFaulted);
    }

    void OnBodyCompleted(NativeActivityContext context, ActivityInstance instance) {

    }

    void OnBodyFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom) {
        faultContext.ScheduleActivity(Body, OnBodyCompleted, OnBodyFaulted);
    }
}

谢谢!

I created a custom activity in a similar way of the article with wf4, its something like this:

public sealed class Retry : NativeActivity {

    public Activity Body { get; set; }

    protected override void Execute(NativeActivityContext context) {
        context.ScheduleActivity(Body, OnBodyCompleted, OnBodyFaulted);
    }

    void OnBodyCompleted(NativeActivityContext context, ActivityInstance instance) {

    }

    void OnBodyFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom) {
        faultContext.ScheduleActivity(Body, OnBodyCompleted, OnBodyFaulted);
    }
}

Thanks!

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