工作流设计难题 - 状态机,是或否 [英] Workflow Design Dilemma - State Machine, yes or no

查看:160
本文介绍了工作流设计难题 - 状态机,是或否的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和WF初学者,但我读过一本书,做了很多使用Google。我想写一个库存管理服务。库存是由其中有一个国家的个别项目:

I'm a beginner with WF, but I've read a book and done a lot of googling. I want to write an inventory management service. The inventory is made up of individual items which have a state:

  1. 备用
  2. 在安装
  3. 在修复

项可能会花费在每个国家个月,并有上千项。

Items may spend months in each state, and there are thousands of items.

现在的问题是,我创建一个状态机工作流的所有不同的状态?还是我创建工作流的状态之间转换?

The question is, do I create a state machine workflow for all the different states? Or do I create workflows for transitioning between states?

如果我理解正确的话,如果我创建一个单一的状态机工作流,那么总会有运行为每个项目的工作流。这意味着数以千计的不断运行的工作流。另外,我需要能够显示每个项目的状态的快照,所以这意味着我必须以某种方式查询所有的工作流程,他们目前都在,否则持续状态转换后的数据库状态。

If I understand correctly, if I create a single state machine workflow, then there will always be a workflow running for every item. This means thousands of ever-running workflows. Also, I need to be able to display a snapshot of the status of each item, so that means I have to somehow query all the workflows for the state they are currently in, or otherwise persist to a database after each state transition.

然而,一个状态机工作流逻辑听起来就像是做正确的事,因此,我的困境。

However, a state-machine workflow logically sounds like the right thing to do, hence my dilemma.

请帮我,如果你可以: - )

Please help me if you can :-)

谢谢!

更新:

假设我有更多的国家比上述3,而且并非所有的状态转换是可能的。

Assume I have more states than the above 3, and that not all state transitions are possible.

赏金奖:莫里斯 - 由于每个人的真正帮助我了解更多关于工作流程中,MS工作流程的基础上,和其他更轻巧的替代品。不幸的是,只能有一个赏金赢家,而莫里斯​​的连同其意见的回答让我最。

Bounty Winner: Maurice - Thanks to everyone else for really helping me understand more about workflows, the MS workflow foundation, and other more lightweight alternatives. Unfortunately, there can only be one bounty winner, and Maurice's answer along with its comments helped me the most.

推荐答案

不知道如果一个工作流程是你在找什么摆在首位。

Not sure if a workflow is what you are looking for in the first place.

工作流是一些业务流程中,发生。这意味着一个开始和结束的过程。你的描述听起来更像是你跟踪各种库存与留在库存物品。

A workflow is some kind of business process that takes place. This implies a beginning and an end to the process. Your description sounds more like you are tracking an inventory of sorts with items that stay in the inventory.

一个工作流的声音更适合当一个项目改变状态。因为当一个项目被安装并打破了,需要固定的例子,你就会开始一个工作流程,以获得部分由AA工作所替代,发出破碎的部分是固定的,到底有没有这回在仓库中作为固定备用。工作流将描述这一过程,并开始与一个项目的报告被打破和与该项目结束被修复或丢弃和更换。

A workflow sound more appropriate when an item changes state. For example when an item is installed and breaks down and needs to be fixed you would start a workflow to get the part replaced by a a working one, send the broken part to be fixed and in the end have it back at the warehouse as a fixed spare. The workflow would describe this process and start with the report of an item being broken and end with the item being either repaired or discarded and replaced.

这最后的工作流程很可能是一个国家worklfow作为该项目经历的各个阶段,如:

This last workflow could very well be a state worklfow as the item goes through various stages like:

  • 破碎和安装
  • 打破,取而代之
  • 在店内进行维修
  • 修复

这篇关于工作流设计难题 - 状态机,是或否的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆