可重用的子工作流程?
我正在开发子工作流程的类库;我有一组用于创建子工作流程的活动。我想将这些子工作流程开发为可重用的工作流程,我可以将其用于创建实际的工作流程。我基本上正在实现现有工作流程的类库,其他人可以使用它来创建实际的业务工作流程。我想要的是,当用户创建一个子工作流程时,它应该自动添加到工作流程的类库中并进行编译,并且应该在运行时作为可重用组件提供。
I am in process of developing Class library of Sub workflows; I have set of Activities which I use for creating Sub workflow. I want to develop these sub workflows as reusable workflows which I can use in creating actual workflows. I am basically implementing Class Library of existing workflows which can be used by others to create actual business workflows. What I want is when user creates one Sub workflow it should be automatically should be added in Class library of workflows and compiled and should be available as reusable component at run time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信我理解您的目标,但这并不像您想象的那么容易。
第一反应是向您的解决方案添加一个活动(添加 => 新项目 => 工作流程 => Actvity),并将其他活动拖到设计图面上。
这将创建可重用的工作流程,不幸的是,它们不会有任何与之关联的设计器。因此,当其他用户尝试从工具箱中拖动这些工作流程并在不同解决方案的工作流程中使用它们时,他们会得到如下内容:
这并不完全有用。另一种方法是创建一个实现 IActivityTemplateFactory< 的自定义活动/a>.这种类型(我相信*)可以添加到工具箱中。将它们拖到设计图面上时,将调用 Create 方法。在此方法中,您可以构建所需的任何工作流程并将其返回。该活动树将添加到工作流中,以便其中的所有活动都可见。
*您可能还需要扩展 Activity 才能使其显示在工具箱中;我对此不太确定。将 Activity 视为实际上从未使用过的虚拟对象。
I believe I understand your goals, however it isn't as easy as you believe it should be.
The first instinct is to add an Activity to your solution (Add => New Item => Workflow => Actvity), and drag other Activities onto the design surface.
This will create reusable workflows, unfortunately they will not have any Designer associated with them. So, when another user attempts to drag these workflows from the toolbox and use them in a workflow in a different solution, they'll get something like this:
That isn't exactly useful. An alternative is to create a custom Activity that implements IActivityTemplateFactory. This type (I believe*) can be added to the Toolbox. When they are dragged onto the design surface, the Create method is called. Within this method, you can construct whatever workflow you want and return it. This activity tree will be added to the workflow so that all activities within it are visible.
*You may also have to extend Activity in order for it to show in the Toolbox; I'm not sure about that. Think of the Activity being a dummy which actually is never used.
这也可能很有用
http://blogs.msdn.com/b/mwinkle/archive/2009/12/24/swiss-cheese-and-wf4-or-an-introduction-to-activityaction.aspx
This may also be useful
http://blogs.msdn.com/b/mwinkle/archive/2009/12/24/swiss-cheese-and-wf4-or-an-introduction-to-activityaction.aspx