关于Workflow Foundation的一些问题

发布于 2024-07-26 23:40:44 字数 297 浏览 1 评论 0原文

1)Code和Callexternalmethod有什么区别?

2) 对于诸如延迟之类的构造,可以将其编码在方法中。 在工作流程中而不是在代码中执行此操作有什么好处?

3)我正在尝试编写一个工作流驱动的CMS。 将根据枚举的状态(所选值)发布页面。 为此,我需要工作流程代码中的类型变量,我发现它背后很混乱。 即便如此,我怎么能在 IfElse 块中说“If (revisionStatus = RevisionStatus.Publish)?我在另一个项目中有一个网页对象,它在其构造函数中设置枚举。

谢谢

1) What is the difference between Code and Callexternalmethod?

2) With constructs such as delay, this can be coded in a method. What benefit is there in doing it in the workflow instead of the code?

3) I am trying to write a workflow-driven CMS. A page will be published depending on the state (selected value) of an enumeration. To do this, I need the type variable in the workflow code behind which I find messy. Even then, how can I say "If (revisionStatus = RevisionStatus.Publish) in an IfElse block? I have a webpage object in another project which sets the enumeration in its constructor.

Thanks

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

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

发布评论

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

评论(1

看轻我的陪伴 2024-08-02 23:40:44

1) 代码活动将方法存根放入与工作流相同的类中(工作流设计器的工作方式与 Windows 窗体设计器类似。如果您单击项目上的“显示所有文件”,您可以看到工作流自动-生成的设计器类)。
CallExternalMethod 调用另一个类中存在的方法。 因此,您不需要将所有逻辑与工作流程放在同一个类中,您可以像平常一样将其分布在其他类中。

2)我想如果它是您的应用程序行为的重要组成部分,那么很高兴在工作流程中看到它(这样您就可以很好地直观地了解正在发生的情况)。 此外,通过工作流延迟活动,您的工作流将被标记为空闲。 因此,如果您使用持久性服务,您的工作流程此时会自动持久化。 您还可以从工作流程外部获取 WorkFlow OnIdle 事件。 我不知道这是否适用于通过代码延迟。

3)不确定我是否正确理解了这一点。 如果您将某些内容传递到工作流程中,您将需要一个属性/字段来将其绑定到,但类型定义不必位于同一个类/程序集中。 只要工作流程所在的项目可以引用您 Enum 所在的项目,就应该没问题。
单击 if else 分支,选择属性。 单击“条件”框,将其更改为“声明性规则条件”。 为您的条件命名,在表达式框中输入 If 语句,就像通常在代码中一样。

1) A Code Activity places method stubs into the same class as the work flow (The work flow designer works in a similar way to the Windows Forms designer. If you click 'Show all files' on your project you can see the work flows auto-generated designer class) .
CallExternalMethod calls a method that exists in another class. So you don't need to put all your logic in the same class as the work flow, you can spread it across other classes like you would normally.

2) I guess if it's a significant part of your applications behaviour it's nice to see it on the work flow (so you can get a good visual overview of what's going on). Also, with the Work flow delay activity your work flow gets marked as Idle. So if you are using a Persistence service you're work flow gets automcaticllay persisted at this point. There's also the WorkFlow OnIdle event that you could pick up from outside the work flow. I dont know if this applies to delays via code.

3) Not sure that I correctly understand this one. If you're passing something into a work flow you are going to need a property / field to bind it to, but the type definition does not have to be in the same class/ assembly. So long as the project the work flow lives in can reference the one you're Enum lives in, you should be fine.
Click your if else branch, select properties. Click the Condition box, change it to * Declarative Rule Condition*. Give your condition a name, in the Expression box enter your If statement like you would normally in code.

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