工作流程支持多个场景

时间:2013-05-28 18:23:45

标签: workflow workflow-foundation-4 workflow-foundation workflow-activity

我正在构建一个基础工作流程,将支持大约25个客户 他们与一个基本工作流程匹配的所有客户,每个客户都有一点点不同的请求让我们说一个客户想要发送电子邮件而另一个客户想要发送电子邮件 我在想什么

  1- make one workflow and in the different requirement I will make switch to check who is   
   the user then switch each user to his requirements 
    (Advantages)this way powerful in maintenance and if there is any common requirements 
                easy to add   
    (Disadvantages) if The customer number increase and be like 100 and each is different 
                  and we expect to have 100 user using the workflow but with the Different 
                  little requirements 
  2- make Differnt workflow for each customer which meaning I will have a 100 workflow 
     in the future and in declaration instantiate the object from the specific workflow 
     which related to the Current user
     (Advantages) each workflow is separate 
     (Disadvantages) - hard to add simple feature this meaning write the same thing 100   
                       time so this is not Professional 

所以我需要什么? 我想知道那些只是我在这种情况下使用的方法还是我错过了另一种技术

1 个答案:

答案 0 :(得分:0)

一种方法是将您的工作流程分解为更小的部分,每个部分都执行特定的操作。您可以组织如下布局,以便能够支持入站请求的多种变体。

Customer1-Activity.xaml
 - Common-Activity1.xaml
 - Common-Activity2.xaml

Customer2-Activity.xaml   
 - Common-Activity1.xaml
 - Common-Activity2.xaml

对于您拥有的任何新客户,您只需创建一个根XAML活动,每个活动都需要对您的传入请求参数进行轻微更改。

选项#2:将字典传入您的活动

考虑一个更好的想法,您可以让工作流具有Dictionary<string, object>类型作为输入参数。字典可以包含为您的工作流程提供的参数/参数集。然后,您的工作流可以查询参数集以使用该信息初始化自身。