采用 WF 的 Web 应用程序的最佳设计是什么?

发布于 2024-11-09 06:01:36 字数 827 浏览 3 评论 0原文

我们目前正在构建一个使用非简单审批流程的应用程序,其中涉及多个级别的审批、返回、审核、通知等。

由于上述要求,我们被要求使用工作流框架来促进流程透明度。

在原型上,我们成功地整合了工作流程,并且运行良好。但是,我们无法确定用户应该可以执行的操作。例如,我有以下接收操作:create()、managerApprove()、RAApprove()、ORMApprove().. 现在,如果我按顺序调用它们,使用正确的用户名,那么它们就会工作。显然,如果我不按顺序调用它们,那么它将抛出一个FaultException,因为它的状态不正确。问题是,我如何知道哪些功能可以在 UI 中公开 - 比如说,如果它当前正在等待经理批准,那么只需为经理显示一个批准按钮...

作为解决方法,我创建了另一个 WCF 服务从数据库检索相同的数据,然后确定正确的 UI 状态(用户可以执行哪些操作)。我认为这是逻辑的重复,因为这已经在 WF 中假设了。

另外,如果 WF 发生更改,那么我单独的 WCF 服务可能会中断。例如,如果我在工作流中切换审批顺序,那么我还需要更新 WCF 服务中的逻辑。否则,它将显示无效的页面状态,并且单击批准将调用错误的方法并导致FaultException。

任何帮助将不胜感激......我真的是 WF4 的新手。

更新:

我的同事这样提出我的问题:

采用 WF 的网络应用程序的最佳设计是什么?

考虑 WF 的主要原因 - 涉及的工作流程长时间运行 - 工作流程是人类工作流程 - 它们需要协调真人的行动 - 流程透明度

另外,工作流程应如何与 UI 集成? - UI 如何知道应该处于什么状态以及向哪些用户显示哪些页面?

We are currently building an application that makes use of a non-simple approval process, which involves multiple levels of approval, returning, reviewing, notifications etc..

Because of the said requirement, we were asked to make use of a workflow framework also to facilitate process transparency.

On the prototype we have succesfully incorporated the workflow and it works fine. however, we cannot determine the actions that should be available to the user. For example, I have the following recieve operations: create(), managerApprove(), RAApprove(), ORMApprove().. now if I call them in order, using the correct user name then they will work. Obviously, if I don't call them in order, then it will throw a FaultException because its not in the correct state. Question is, how will I know which functions are available to expose in the UI - say, if its currently waiting for manager approval then just show an approval button for the manager...

As a workaround, I've created another WCF service that retrieves the same data from the database and then determines the correct UI state (which actions can be performed by the user). I think this is a duplication of logic, since that's supposed in the WF already.

Also, if the WF changes then it my seperate WCF service may potentially break. For example, if I switch the approval order in the workflow then I need to update the logic in the WCF service as well. Otherwise, it would show an invalid page state and clicking approve will invoke the wrong method and cause a FaultException.

Any help will be much appreciated... I'm really new to WF4.

UPDATE:

My colleague put my question this way:

What's the best design for a web app that adopts WF?

The main reasons why WF is being considered
- The workflows involved are long running
- Workflows are human workflows - they need to coordinate actions of real people
- Process Transparency

Also, how should the workflow integrate with the UI? - how will the UI know what state in should be in and what pages to show which users?

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

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

发布评论

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

评论(2

小巷里的女流氓 2024-11-16 06:01:36

工作流程本身并不直接公开信息。它在那里,因为每个挂起的接收都是一个命名书签,并且书签名称包含它支持的 SOAP 操作以及服务契约和命名空间。实现此目的的最简单方法是将 SqlWorkflowInstanceStore 添加到 WorkflowServiceHost 并检查带有待处理书签的列。它并不完美,因为这将为您提供最后保留的信息,这不一定是当前状态,但它在许多应用程序中对我有用。只需确保将 TimeToPersist 设置为相当低的值,并在战略位置添加一些 Persist 活动即可。

The workflow itself doesn't expose the information directly. It is there as each pending Receive is a named bookmark and the bookmark name contains the SOAP action it supports as well as the service contract and namespace. The easiest way of getting at this into is by adding the SqlWorkflowInstanceStore to the WorkflowServiceHost and checking the column with the pending bookmarks. It isn't perfect as this will give you the information as it was last persisted which is not necessarily the current state but it has worked for me in a number of applications. Just make sure to set the TimeToPersist to a pretty low value and add some Persist activities in strategic places.

浅浅 2024-11-16 06:01:36

一种非常简单的方法是通过管理审批状态来模拟工作流程。想象一下,您有不同的按钮/页面供不同的用户批准审批流程的不同阶段(“创建”、“经理批准”、“RA 批准”等)。这是一种非常古老的方法。

如果您使用这种方法,您将需要将工作流程(逻辑/流程)分布到不同的位置(页面)。显然,这是这种方法的一个缺点,特别是当您的工作流程发生很大变化或者您的解决方案需要运行不同版本的工作流程时。

如果您想使用 Workflow Foundation,最简单的方法就是莫里斯建议的方法。

另一种选择是使用比 WF 更具扩展性且更灵活的其他工具。我使用过 WF(尽管不是最新版本)、BizTalk 和 SharePoint。

如果您的解决方案需要与其他应用程序交互,我建议使用 BizTalk。

A very simple approach would be simulating the workflow by managing the status of the approvals. Imagine that you have different buttons/pages for different users to approve different stages ("create", "manager approval", "RA approveal", etc) of the approval process. This is a very old school approach.

If you use this approach, you would need to distribute your workflow (logics/process) accross different places (pages). Obviously, this is a downside of this aproach, specially when your workflow changes a lot or your solutions needs to run different versions of a workflow.

If you want to use Workflow Foundation, the easiest way is what Maurice has suggested.

The other option is to use other tools which would scale more and are more flexible than WF. I have used WF (not the lastest release though), BizTalk, and SharePoint.

If your solution requires interacting with other applications, I would recommned using BizTalk.

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