zoukankan      html  css  js  c++  java
  • Workflow Activity的介绍(按VS工具箱字母排序)

      学习Workflow一段时间,看到VS中的控件那么多,就把它们搜集整理出来了,并做以简要介绍,做到心中有数。详细了解可以参考 听风切吟,兰梅竹菊 的博客。
         命名空间: System.Workflow.Activities
         程序集: System.Workflow.Activities(在 system.workflow.activities.dll 中)
    Workflow各类Activity的介绍(按vs工具箱字母排序) 
    命名空间: System.Workflow.Activities
    程序集: System.Workflow.Activities(在 system.workflow.activities.dll 中)

    1、CallExternalMethodActivity 控件介绍
    MSDN: Defines a workflow communication activity that is used to call a method on a
    local service. This activity is used to send data from the workflow to the host through the local service.
        此控件主要是用于可以和宿主进程提供的本地服务进行通信。首先应该设置的是
    InterfaceType属性,设计器会通过我们设置的接口来自动发现服务中所有可用的方法。一旦我们把InterfaceType设置为之前定义的接口,我们就可以为MethodName属性选择需要调用的方法,设计器还会在属性面板中列出该方法需要的参数。我们可以将这些输入参数和方法的返回值绑定到工作流的域或属性。
    2、Code 控件介绍
    MSDN: Runs the code-beside method associated with an activity. This class cannot be
    inherited.
         此控件主要是辅助其他Activity工作的,用于编写代码。不能用于继承。
    3、CompensatableSequenceActivity 控件介绍
    MSDN: Defines a compensatable version of the SequenceActivity activity. This class
    cannot be inherited.
         在网上找了下加上自己的理解为:可补偿的 SequenceActivity.
         在逻辑单元执行发生异常时,对异常的处理(补偿);
    4、TransactionScope 控件介绍
    MSDN: Executes contained activities sequentially and in transaction.
         活动会启动一个事务并隐式的记录所有包含在事务里的活动;例如银行转帐事务处理,一
    个完整的事务,要么完全实现要么完全回退。
    5、CompensatableTransactionScopeActivity 控件介绍
    MSDN: Executes contained activities sequentially and in transaction and supports
    compensation.
         功能相当于附加了补偿处理程序的TransacionScope;Transaction类可以管理使用各种类
    型持久化存储的事务。
    6、Compensate 控件介绍
    MSDN:Enabled compensating for scope supporting for Longing Running Transaction.
         对长时间运行事务的补偿.就算工作流需要长时间运行,我们也不愿让一个事务花费数小时
    ,数日甚至数周去执行.因为事务在提交之前会加锁记录以防止来自其它执行过程的查询.但是长期加锁事务不仅磨灭程序的可伸缩性,甚至会造成死锁.
    7、ConditionedActivityGroup 控件介绍
    MSDN: Provides the definition of a constraint-based execution context for a set of
    child activities.
         条件组.CAG是一个强大的活动,它可以结合规则和代码来达到目的.CAG的每一步执行都会
    检查条件否允许.我们可以在CAG内部添加许多活动来执行.CAG为它的每一个子活动都关联了WhenCondition并且只执行的WhenCondition为真的活动.CAG会一直重复执行它的子活动直到其UntilCondition为真.
    8、Delay 控件介绍
    MSDN: Provides the logic to establish a timer and to wait, asynchronously, for
    timer's expiration. This class cannot be inherited.
         功能类似VS中Timer控件。Delay活动会初始化一个计时器并等待它到期. Delay活动经常
    被用来模拟超时, 当计时器到期后工作流引擎还会继续执行.它的TimeoutDuration属性的值是TimeSpan类型,表示需要等待的时间.我们可以在设计器中初始化这个属性,也可以以编程的方式在InitializeTimeoutDuration事件中更改它的值。
    9、EventDriven 控件介绍
    MSDN: Wraps an Activity whose execution is initialized by an event. This class
    cannot be inherited. It is a CompositeActivity that is used to handle an event; typically it can be raised from the host or by the run time in reponse to a delay timer expiring. EventDrivenActivity is inherited from SequenceActivity; therefore it is a sequence that has the additional restriction that the first activity should be an IEventActivity.
         用于依赖于外部事件才能开始执行的状态.它是一个CompositeActivity,所以可以包括其
    他activities.EventDrivenActivity必须有一个Activity实现在了EventActivity 接口,作为其第一个子活动.
    10、EventHandlingScope 控件介绍 
    MSDN: Enables event handling with the execution of the child activities. This class
    cannot be inherited.
         EventHandlingScope活动可包含多个等待事件的分支.EventHandlingScope在其主要子活
    动未执行完之前会一直监听其余的事件.
    11、FaultHandler 控件介绍
    MSDN: Enables execution of contained activities based on specified exception.
         捕捉处理包含的activities发生的异常.和try...catch块功能相似。
    12、HandleExternalEvent 控件介绍
    MSDN: Defines a workflow communication activity that is used to handle an event
    that is raised by a local service.
         捕捉处理本地服务引起的异常(宿主抛出的异常).
    13、IfElse 控件介绍
    MSDN: Conditionally runs one of two or more activities of type
    IfElseBranchActivity. This class cannot be inherited.
         功能类似于if...else if...else块.可以添加多个分支.
    14、InvokeWebService 控件介绍
    MSDN: Invokes a Web service through a proxy class, passing and receiving parameters
    as specified. This class cannot be inherited.
         调用Web service.传递或者接收参数.当添加该控件时,会出现一个添加Web引用的向导,
    可在向导中完成对SoapHttpClientProcotol的实现.
    15、InvokeWorkflow 控件介绍
    MSDN: Asynchronously runs one workflow from another.This class cannot be inherited.
         活动可以异步的执行另一个工作流.因为执行过程是异步的,所以我们无法获取另一个工作
    流的输出参数,但我们可以和宿主建立额外的通信机制来获取其输出.在开始另一个工作流之前,InvokeWorkflow活动将触发Invoking事件,可以在此事件内编写代码来初始化参数.
    16、Listen 控件介绍
    MSDN: Makes the workflow wait for any one of several possible events before the
    activity proceeds. This class cannot be inherited.
         侦听消息。这个可以同时侦听很多消息。Listen活动可以包含多个分支.但不同的是
    Listen活动的目的仅仅是完成一个分.Listen活动的分支是EventDriven活动,EventDriven活动的特点是它必须以事件的到达为其开始的条件.
    17、Parallel 控件介绍
    MSDN: Runs a set of child activities at the same time. This class cannot be
    inherited.
         Parallel活动允许多个活动同时执行,但Parallel活动并没有采用多线程机制,在工作流内
    部只有一个线程执行.
    18、Policy 控件介绍
    MSDN: Represents a collection of Rule class instances to be run as part of a
    workflow's execution as a single step/activity.
         封装了一个集成的的规则实例,允许你在工作流执行中(Activities)使用这些规则.Policy
    Activity很多时候不能直接使用(特别是不能在VS2005的工具箱),你需要从Policy Activity继承并且创建一个自定义的 Activity来使用Policy Activity和这些规则。
    19、Replicator 控件介绍
    MSDN: Executes contained activities by creating specified number replicated
    instance.
         Replicator活动和While活动类似,而且更加复杂.通过设置其ExecutionType属
    性,Replicator可以处理顺序或者并行的数据集合.
    20、Sequence 控件介绍
    MSDN: Runs a set of child activities according to a single defined ordering.
         按照顺序执行一系列包含的activities,直到最后一个.
    21、Suspend 控件介绍
    MSDN: Suspends execution of workflow.
         一个挂起流程的结点,与在宿主中使用.
    22、SynchronizationScope 控件介绍
    MSDN: Executes contained activities sequentially in a synchronized domain.
         顺序执行同步范围内的activities。我们知道,Parallel活动会同时执行它的每个分支,
    SynchronizationScope活动则正好相反,它的作用是阻止将要同时执行的活动,并让它们一个接一个的执行.SynchronizationHandles属性中包含相同的同步句柄,这几个SynchronizationScope活动就不会同时执行,每当一个SynchronizationScope活动完成,相同的步句柄就会被释放,接着刚才一直出于等待状态的其它实例中会有一个获得此同步句柄然后开始执行,并且这几个活动执行完后才会执行其他的.
    23、Terminate 控件介绍
    MSDN: Terminates execution of workflow.
         和Suspend活动相似,Terminate活动也可以挂起工作流.不同的是,使用Terminate挂起的工
    作流是无法被宿主恢复执行的(从单词含义来理解会更加容易:Suspend,暂停;Terminate,终止).如果工作流已经执行到不可能继续(也不可能恢复)的地步,就让我们用这个活动来结束它
    24、Throw
    MSDN: Enables raising exception in workflow.
         在工作流执行时抛出异常.
    25、WebServiceFault
    MSDN: Enables sending a fault to the Web service client from the workflow. This
    class cannot be inherited.
         WebServiceFault活动允许我们抛出异常(Runtime会将此异常封装到SOAP异常中).它的
    Fault属性用来引用我们想要抛出的异常.
    26、WebServiceInput
    MSDN: Enables receiving data from a Web service in a workflow. This class cannot be
    inherited.
         WebServiceInput活动允许工作流接收一个Web Service请求.和之前讨论过的本地通信活
    动类似,使用这个活动之前,我们需要定义一个合同(接口).WebServiceInput活动会实现这个接口.当我们设置了活动的InterfaceType属性之后,我们可以从MethodName属性中选择从接口继承而来的方法,并且可以将其参数绑定到工作流的域或者属性.
    27、WebServiceOutput
    MSDN: Enables sending data to a Web service from within a workflow. This class
    cannot be inherited.
         WebServiceOutput活动必须和WebServiceInput活动是配对出现,它负责响应来自Web
    Service的请求.这个活动的InputActivityName属性来选择配对的WebServiceInput活动, 所以我们不能在没有WebServiceInput活动的情况下使用这个活动.设计器会检查配对WebServiceInput活动实现的接口和方法名,并允许我们将ReturnValue属性绑定到工作流的域或属性,而ReturnValue属性就是对于Web Service的响应.  
    28、While
    MSDN: Runs a child activity iteratively as long as a certain condition is true.
         和C#的while功能类似,While活动会在每次循环之前判断其条件是否满足.如果满
    足,WhileActivity将一直运行.

    出处: http://www.cnblogs.com/windy2008

  • 相关阅读:
    【41】了解隐式接口和编译期多态
    【17】以独立语句将newed对象置入智能指针
    【16】成对使用new和delete时要采取相同形式
    【15】在资源管理类中提供对原始资源的访问
    【14】在资源管理类中小心copying行为
    【02】尽量以const,enum,inline替换#define
    【01】视C++为一个语言联邦
    一次数据库hang住的分析过程
    针对某个数据库error做systemstate dump
    数据库hang住如何收集信息
  • 原文地址:https://www.cnblogs.com/windy2008/p/1213819.html
Copyright © 2011-2022 走看看