如何使用 WF4 规则运行 WF4 活动

发布于 2024-11-10 11:18:03 字数 474 浏览 3 评论 0原文

我正在尝试制作发票处理工作流程,并且涉足了 WF4 的 System.Activities.Rules 部分,我有点喜欢它。然而,我想以规则为起点,而不是先踢一个活动。

像这样

传入的发票集合=发票

对于每张发票,将其放入一个信封中,其中将包含状态、下一个活动等工作流元数据。

将信封放在一组规则上,如果条件匹配,则使用一组参数设置下一个活动,例如IF CustomerID = XYZ then setNextActivity(SplitInvoiceActivity(Customer1,Customer2, Percentage))

然后活动将发票分成 2 个发票并将它们放回循环,当没有规则适用时,我们将信封状态设置为“已处理完成”之类的状态,然后退出。

我如何使用 WF4 活动对此进行建模? 我应该从哪种类型的 Activity 派生,nativeActivity、CodeActivity 等。

提前谢谢!

I am trying to make an invoice processing workflow and I dabbled with the System.Activities.Rules part of WF4 and I kindof like it. However I would like to take the starting point with the rules instead of kicking of an Activity first.

Like this

Incomming collection of invoices = Invoices

For each invoice put it in an envelope wich will contain Workflow metadata like status, nextActivity etc.

Throw the envelope on a set of Rules that if the condition matches sets the next Activity with a set of parameters like this, IF CustomerID = XYZ then setNextActivity(SplitInvoiceActivity(Customer1,Customer2, Percentage))

then the Activity splits the invoice into 2 invoices and puts them back into the loop and when no rules Applies we set the Envelope state to something like "Processed Done" and it exits.

How would I model this with WF4 activities?
Wich type of Activity should I derive from, nativeActivity, CodeActivity etc.

Thx in advance!

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

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

发布评论

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

评论(1

看透却不说透 2024-11-17 11:18:03

System.Activities.Rules 命名空间从哪里来? WF4中没有这样的东西。 WF3中有一个System.Workflow.Activities.Rules命名空间,但它与WF4完全无关。有一些关于如何在两种技术之间进行互操作以及如何在 WF4 工作流中使用 WF3 规则引擎的示例,但我真的不推荐这种方法。

关于您的活动基类操作。一般来说,从 CodeActivity 派生出来,用于完成一些工作并完成的简单活动。仅当您需要更强大的活动(由多个子活动组成)或需要长时间运行并创建书签时,您才需要使用 NativeActivity。也就是说,您可以一直使用 NativeActivity,因为 CodeActivity 中没有您在 NativeActivity 中做不到的事情,而且也没有真正的性能差异。

Where is the System.Activities.Rules namespace coming from? There is no such thing in WF4. There is a System.Workflow.Activities.Rules namespace in WF3 but it is completely unrelated to WF4. There are some samples on how to interop between the two technologies and use the WF3 rule engine in a WF4 worklfow but I can't really recommend that approach.

With regards to you activity base class action. In general derive from CodeActivity for the simple kind of activities that do some work and are done. Only when you need more powerful activities that are either composed of multiple child activities or need to be long running and create bookmarks do you need to use a NativeActivity. That said, you can just use NativeActivity all the time because there is nothing in CodeActivity that you can't do in a NativeActivity and there is no real performance difference either.

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