Workflow Foundation 适用性 - 复制存储的信息
鉴于在 Workflow Foundation 中,“工作流实例”存储有关该实例在工作流中的运行情况的信息,人们会如何建议对此进行报告?
人为示例
考虑修复 PC 的工作流程。它有简单的状态:调查、获取零件、修理、返回。
理论上,我的数据库中可能还有一个名为 RepairJob
的表,其中每条记录都与作业相关。技术人员、sku 等都会有外键。
但是,我可能想按 RepairJob
的当前状态查询它们:
select * from RepairJob where StatusId = @statusId
但实际上,这意味着以某种方式复制 RepairJob< 的当前“状态” /code> 在工作流实例和数据库中。这意味着我的工作流程操作在激活时需要执行一些操作来触发数据库更新。
这是 Workflow Foundation 可接受的用途吗?其他人如何使用它?
非常感谢。
Given that in Workflow Foundation, a "Workflow Instance" stores the information about how far through the workflow that instance is, how would people recommend reporting on that?
Contrived Example
Consider a workflow for repairing a PC. It has simple states: Investigating, Obtaining parts, Repairing, Returning.
In theory I might also have in my database a table called RepairJob
, where each record relates to the job. There will be foreign keys to technicians, skus etc.
However, I might want to query RepairJob
s by their current state:
select * from RepairJob where StatusId = @statusId
But effectively this means somehow duplicating the current "state" of a RepairJob
both in the workflow instance and in the database. It means that my workflow actions need to do something when activated that fires off the database update.
Is this the accepted use for Workflow Foundation? How are other people using it?
Many thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以使用工作流程和状态表来做到这一点。
执行此操作的简单方法是将“更新状态表”活动作为工作流程中的每隔一个活动。
如果您想做一个更优雅的解决方案,您可以创建一个自定义活动,该活动具有其状态属性,并自动更新状态表。但这可能是超出其价值的工作。
Yes, you can do it like that with a workflow and a status table.
The simple way to do it is just to have a "Update Status Table" activity as every second activity in your workflow.
If you wanted to do a bit more elegant solution you could create a custom activity that had a property of which status it was, and automatically updated the status table. But that is probably more work than it is worth.