最佳实践:将项目的工作流程状态存储在数据库中?

发布于 2024-07-06 01:41:40 字数 1449 浏览 4 评论 0原文

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

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

发布评论

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

评论(5

肥爪爪 2024-07-13 01:41:40

我想我会将 Workflow 对象序列化为 XML 并使用 ID 列存储在数据库中。 报告可能更困难,但听起来它可能适合您的情况。

I think I would serialize the Workflow object to XML and store in the database with an ID column. It may be more difficult to report on, but it sounds like it may work in your case.

久隐师 2024-07-13 01:41:40

序列化和数据库模型的混合怎么样? 拥有一个用作主工作流程文档的 XML 文档,其中包含每个步骤的节点,其中包含详细说明其名称、流程中的顺序、是否可选的条件等的属性和元素。最重要的是,每个步骤节点都可以有一个唯一的步骤 ID。

然后在您的数据库中您有一个简单的两个表结构。 BoxItems 表存储您的基本 BoxItem 数据。 然后是一个 BoxItemActions 表,与您标记为答案的解决方案非常相似。

它本质上与作为答案接受的解决方案类似,但您使用的不是 BoxItemTasks 表来存储任务主列表,而是使用 XML 文档,该文档为实际工作流定义提供了更大的灵活性。

How about a hybrid of the serialization and the database models. Have an XML document that serves as your master workflow document, containing a node for each step with attributes and elements that detail it's name, order in the process, conditions for whether it's optional or not, etc. Most importantly each step node can have a unique step id.

Then in your database you have a simple two table structure. The BoxItems table stores your basic BoxItem data. Then a BoxItemActions table much like in the solution you marked as the answer.

It's essentially similar to the solution accepted as the answer, but instead of a BoxItemTasks table to store the master list of tasks, you use an XML document that allows for some more flexibility for the actual workflow definition.

残疾 2024-07-13 01:41:40

无论如何,在 BizTalk 中,它们通过将长时间运行的消息模式(工作流等)二进制序列化到数据库来“脱水”它们。

For what it's worth, in BizTalk they "dehydrate" long-running message patterns (workflows and the like) by binary serializing them to the database.

清风挽心 2024-07-13 01:41:40

如果我理解正确,我将添加 BoxItemTasks 表(只是一个枚举表,对吧?),然后添加一个 BoxItemActions 表,其中包含 BoxItems 的外键和 BoxItemTasks 的外键以了解其是什么类型的任务。 如果您想让特定任务只能对特定框项目执行一次,只需将 (Items + Tasks) 列对作为 BoxItemActions 的主键即可。

(你的布局比我做得更好,并且正确解释了我所说的内容。你写的正是我所想象的。)

至于确定当前状态,你可以在 BoxItemActions 上编写一个触发器来更新单个列 BoxItems.LastAction。 对于并发操作,您的触发器可能只有特殊情况来决定哪个操作需要新近度。

If I'm understanding correctly, I would add the BoxItemTasks table (just an enumeration table, right?), then a BoxItemActions table with foreign keys to BoxItems and to BoxItemTasks for what type of task it is. If you want to make it so that a particular task can only be performed once on a particular box item, just make the (Items + Tasks) pair of columns be the primary key of BoxItemActions.

(You laid it out much better than I did, and kudos for correctly interpreting what I was saying. What you wrote is exactly what I was picturing.)

As for determining the current state, you could write a trigger on BoxItemActions that updates a single column BoxItems.LastAction. For concurrent actions, your trigger could just have special cases to decide which action takes recency.

梦晓ヶ微光ヅ倾城 2024-07-13 01:41:40

正如前面的答案所建议的,我会将您的桌子分成几张。

BoxItemActions,包含工作流需要执行的操作列表,每次创建 BoxItem 时都会创建。 在此表中,您可以跟踪每项任务完成的详细日期\时间\用户。

对于这种类型的应用程序,了解 Box 接下来要去哪里可能会变得非常棘手,因此拥有 Box 剩余步骤的“地图”将非常有帮助。 此外,该表可以疯狂地分组,每个框数百行,并且仍然很容易查询。

它还使得可以轻松更改“不同路径”。 工作流程“路径”的主数据表是一种解决方案,在创建每个盒子时,用户必须选择该盒子将遵循的“路径”。 或者,您可以进行设置,以便当用户创建该框时,他们选择该特定框所需的任务。 取决于我们的业务问题。

As the previous answer suggested, I would break your table into several.

BoxItemActions, containing a list of actions that the work flow needs to go through, created each time a BoxItem is created. In this table, you can track the detailed dates \ times \ users of when each task was completed.

With this type of application, knowing where the Box is to go next can get quite tricky, so having a 'Map' of the remaining steps for the Box will prove quite helpful. As well, this table can group like crazy, hundreds of rows per box, and it will still be very easy to query.

It also makes it possible to have 'different paths' that can easily be changed. A master data table of 'paths' through the work flow is one solution, where as each box is created, the user has to select which 'path' the box will follow. Or you could set up so that when the user creates the box, they select tasks are required for this particular box. Depends on our business problem.

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