加载工作流实例

发布于 2024-11-30 20:54:39 字数 687 浏览 1 评论 0原文

假设我有一个网络应用程序,我需要在一个页面中上传一份文档。然后文档被转换为其他内容,然后用户可以看到转换后的文档。

我想要一个有 4 个状态的工作流程。

  1. 上传的
  2. 正在转换
  3. 已转换

因此现在用户进来并创建文档记录并上传文件。

此时,他们需要被带到仪表板,告诉他们文档正在转换。他们可能会注销并稍后再回来。

文档转换后,他们将可以继续查看文档的下一步。

我可以轻松创建一个具有这些状态的工作流程,并根据文档记录的标志执行所有状态检查和设置。

我认为我缺少的是,如果用户注销并返回,我如何获取该上传文档的工作流程并检查其在工作流程中的状态?

我所拥有的就是这个;

WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(WorkflowProject1.Workflow1), parms);

instance.Start();

其中 params 是文档 ID。当我返回应用程序时,如何获取此文档的工作流程实例并检查其当前步骤?

任何指向简单 WWF 示例/示例站点的链接将不胜感激。

事实上有更好的方法吗?

另外,加载工作流程后,如何检查其当前步骤或活动?

Say I have a web application and in one page I need to upload a document. Then the document get's converted into something else and then the user can see the converted document.

I want a workflow that will have 4 states.

  1. New
  2. Uploaded
  3. Converting
  4. Converted

So now the user comes in and creates a document record and uploads the file.

At this point they will need to be taken to a dashboard which tells them the document is being converted. They may log off and come back later.

Once the document is converted they will be allowed to progress to the next step of viewing the document.

I can easily create a workflow that has these states and does all the checking and setting of states depending on flags against the document record.

What I am missing I think, is that if the user logs off and comes back, how do I grab the workflow for that uploaded document and check it's state in the workflow?

All I have is this;

WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(WorkflowProject1.Workflow1), parms);

instance.Start();

Where params is the document id. When I come back into my application how do I get the workflow instance for this document and check it's current step?

Any links to simple WWF sample/example sites would be greatly appreciated.

Is there in fact a better way of doing this?

Also, once I have the workflow loaded, how can I then check its current step or activity?

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

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

发布评论

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

评论(1

滴情不沾 2024-12-07 20:54:39

其中一种方法可以如本文所述:http: //ajdotnet.wordpress.com/2007/09/30/workflow-instance-state-management/

本质上,您将工作流状态保存到数据库表中(持久性由工作流管理),并且 Web 应用程序读取直接从数据库获取状态。这实际上是我更喜欢的更简单的方法,因为状态信息在工作流实例之外可用。

另一种方法可能是使用持久性服务,例如 SqlWorkflowPersistenceService 将工作流状态保存到数据库中。持久性由持久性服务管理,工作流忽略这一事实。您已使用 Load 工作流方法实例来加载状态(以及 卸载以保存)。然而,调用这些方法的所有粘合逻辑都将位于 aspx 页面中。我的方法问题是您必须执行同步逻辑(如果需要)并且为了读取状态信息,您必须将其加载到工作流实例中。

One of the way could be as described in this article: http://ajdotnet.wordpress.com/2007/09/30/workflow-instance-state-management/

Essentially, you persist workflow state into a database table (the persistence is managed by the workflow) and web application reads the status from database directly. This is actually simpler approach that I would prefer because state information is available outside workflow instance.

Another approach could be to use persistence service such as SqlWorkflowPersistenceService to persist the workflow state into the database. The persistence is managed by the persistence service and workflow is oblivious of the fact. You have use Load method of workflow instance to get the state loaded (and Unload for saving). However all glue logic of calling these methods would sit in aspx page. My issue with approach is that you have do synchronization logic (if needed) and for reading the state information, you have to load that into a workflow instance.

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