Compartilhar via


Windows Workflow Foundation Activities

Windows Workflow Foundation (WF) includes a default set of activities that provide functionality for control flow, conditions, event handling, state management, and communicating with applications and services. When you design workflows, you can use the activities that are provided by Windows Workflow Foundation, and you can create your own custom activities.

Activities are the fundamental building blocks of workflows. A workflow is a set of activities that are organized hierarchically in a tree structure. An activity represents an action in a workflow. It can be a simple action such as a delay, or it can be a composite activity that consists of several child activities.

An activity, like a workflow, can be sequential, which means that the order of its actions is specified at design time. Or the activity can be event-driven, which means that the order of its actions is determined at run time in response to external events.

Every activity has an activity execution context that represents the execution environment of the activity. An activity execution context is similar to an HTTP context in that an object has a state, a set of parameters, and constructs that are unique to that given object for that given point in time. Certain composite activities, such as ReplicatorActivity activities and WhileActivity activities, create multiple instances of their child activities during execution, and each child activity has its own activity execution context that it runs in. For more information about activity execution contexts, see Understanding the Activity Execution Context.

Every activity also transitions through various states during its lifetime. Some transitions are controlled by the workflow runtime engine, while others can be user-controlled, such as transitioning a child activity from Executing to Closed. For more information about activity states, see Understanding the Activity State Model.

The following table lists the activities in the Windows Workflow Foundation base activity library.

Activity Description

CallExternalMethodActivity

Used with the HandleExternalEventActivity activity for input and output communications with a local service. For more information, see Using the CallExternalMethodActivity Activity.

CancellationHandlerActivity

Used to contain cleanup logic for a composite activity that is canceled before all the composite activity's child activities are finished executing. For more information, see Using the CancellationHandlerActivity Activity.

CodeActivity

Enables you to add Visual Basic or C# code to your workflow. For more information, see Using the CodeActivity Activity.

CompensatableSequenceActivity

Compensatable version of SequenceActivity. For more information, see Using the CompensatableSequenceActivity Activity.

CompensatableTransactionScopeActivity

Compensatable version of TransactionScopeActivity. For more information, see Using the CompensatableTransactionScopeActivity Activity.

CompensateActivity

Enables you to call code to undo or to compensate for operations already performed by the workflow when an error occurs. For more information, see Using the CompensateActivity Activity.

CompensationHandlerActivity

Wrapper for one or more activities that perform compensation for a completed TransactionScopeActivity activity. For more information, see Using the CompensationHandlerActivity Activity.

ConditionedActivityGroup

Executes child activities based on a condition that applies to the ConditionedActivityGroup activity itself and based on conditions that apply separately to each child. For more information, see Using the ConditionedActivityGroup Activity.

DelayActivity

Enables you to build delays in your workflow based on a time-out interval. For more information, see Using the DelayActivity Activity.

EventDrivenActivity

Wraps one or more activities that are executed when a specified event occurs. For more information, see Using the EventDrivenActivity Activity.

EventHandlersActivity

Provides a framework for associating events with an activity. For more information, see Using the EventHandlersActivity Activity.

EventHandlingScopeActivity

Executes its main child activity concurrently with an EventHandlersActivity activity. For more information, see Using the EventHandlingScopeActivity Activity.

FaultHandlerActivity

Used to handle an exception of a type that you specify. For more information, see Using the FaultHandlerActivity Activity.

FaultHandlersActivity

Represents a composite activity that has an ordered list of child activities of type FaultHandlerActivity. For more information, see Using the FaultHandlersActivity Activity.

HandleExternalEventActivity

Used together with the CallExternalMethodActivity activity for input and output communications with a local service. For more information, see Using the HandleExternalEventActivity Activity.

IfElseActivity

Tests a condition on each branch and performs activities on the first branch for which the condition equals true. For more information, see Using the IfElseActivity Activity.

IfElseBranchActivity

Represents a branch of an IfElseActivity activity. For more information, see Using the IfElseBranchActivity Activity.

InvokeWebServiceActivity

Enables your workflow to invoke a Web service. For more information, see Using the InvokeWebServiceActivity Activity.

InvokeWorkflowActivity

Enables your workflow to invoke another workflow. For more information, see Using the InvokeWorkflowActivity Activity.

ListenActivity

A composite activity that contains only EventDrivenActivity child activities. For more information, see Using the ListenActivity Activity.

ParallelActivity

Lets you schedule two or more child SequenceActivity activity branches for processing at the same time. For more information, see Using the ParallelActivity Activity.

PolicyActivity

Used to represent a collection of rules. A rule consists of conditions and resulting actions. For more information, see Using the PolicyActivity Activity.

ReceiveActivity

Implements a service contract operation using Windows Communication Foundation (WCF).

ReplicatorActivity

Creates multiple instances of a single child activity. For more information, see Using the ReplicatorActivity Activity.

SendActivity

Invokes a client-side synchronous operation of a service using Windows Communication Foundation (WCF) .

SequenceActivity

Provides a simple way to link multiple activities together for sequential execution. For more information, see Using the SequenceActivity Activity.

SetStateActivity

Specifies a transition to a new state. For more information, see Using the SetStateActivity Activity.

StateActivity

Represents a state in a state machine workflow. For more information, see Using the StateActivity Activity.

StateFinalizationActivity

Used in a StateActivity activity as a container for child activities executed when leaving the StateActivity activity. For more information, see Using the StateFinalizationActivity Activity.

StateInitializationActivity

Used in a StateActivity activity as a container for child activities executed when entering the StateActivity activity. For more information, see Using the StateInitializationActivity Activity.

SuspendActivity

Suspends the operation of your workflow to enable intervention in the event of some error condition that requires special attention. For more information, see Using the SuspendActivity Activity.

SynchronizationScopeActivity

Executes contained activities sequentially in a synchronized domain. For more information, see Using the SynchronizationScopeActivity Activity.

TerminateActivity

Enables you to immediately end the operation of your workflow in the event of an error condition. For more information, see Using the TerminateActivity Activity.

ThrowActivity

Enables you to capture business exceptions thrown as part of the process metadata for a workflow. For more information, see Using the ThrowActivity Activity.

TransactionScopeActivity

Provides a framework for transactions and exception handling. For more information, see Using the TransactionScopeActivity Activity.

WebServiceFaultActivity

Lets you model the occurrence of a Web service fault. For more information, see Using the WebServiceFaultActivity Activity.

WebServiceInputActivity

Receives data from a Web service. For more information, see Using the WebServiceInputActivity Activity.

WebServiceOutputActivity

Responds to a Web service request made to a workflow. For more information, see Using the WebServiceOutputActivity Activity.

WhileActivity

Enables your workflow to loop until a condition is met. For more information, see Using the WhileActivity Activity.

For information about how to create your own activities, see Developing Windows Workflow Foundation Activities.

In This Section

Understanding the Activity Execution Context

Understanding the Activity State Model

Using the CallExternalMethodActivity Activity

Using the CancellationHandlerActivity Activity

Using the CodeActivity Activity

Using the CompensatableSequenceActivity Activity

Using the CompensatableTransactionScopeActivity Activity

Using the CompensateActivity Activity

Using the CompensationHandlerActivity Activity

Using the ConditionedActivityGroup Activity

Using the DelayActivity Activity

Using the EventDrivenActivity Activity

Using the EventHandlersActivity Activity

Using the EventHandlingScopeActivity Activity

Using the FaultHandlerActivity Activity

Using the FaultHandlersActivity Activity

Using the HandleExternalEventActivity Activity

Using the IfElseActivity Activity

Using the IfElseBranchActivity Activity

Using the InvokeWebServiceActivity Activity

Using the InvokeWorkflowActivity Activity

Using the ListenActivity Activity

Using the ParallelActivity Activity

Using the PolicyActivity Activity

Using the ReplicatorActivity Activity

Using the SequenceActivity Activity

Using the SetStateActivity Activity

Using the StateActivity Activity

Using the StateFinalizationActivity Activity

Using the StateInitializationActivity Activity

Using the SuspendActivity Activity

Using the SynchronizationScopeActivity Activity

Using the TerminateActivity Activity

Using the ThrowActivity Activity

Using the TransactionScopeActivity Activity

Using the WebServiceFaultActivity Activity

Using the WebServiceInputActivity Activity

Using the WebServiceOutputActivity Activity

Using the WhileActivity Activity

Reference

System.Workflow.Activities

System.Workflow.ComponentModel

Developing Windows Workflow Foundation Activities

Copyright © 2007 by Microsoft Corporation. All rights reserved.
Last Published: 2010-03-04