Generic Activities

Workflow Designer is built using the Windows Workflow Foundation (WF) in the .NET Framework. It contains Microsoft's built-in (generic) workflow activities and activities created specifically for Anthology products (CMC Activities).

The Microsoft WF activity library contains the activities described below. These activities are used in conjunction with the CMC Activities developed for Anthology.

For detailed information about WF features first introduced in .NET 4.5 refer to http://msdn.microsoft.com/en-us/library/vstudio/hh305677(v=vs.110).aspx.

Collection

Collection activities are used to work with collection objects in a workflow. The .NET Framework has system-provided activities for adding and removing items from a collection, testing for the existence of an item in a collection, and clearing a collection. ExistsInCollection and RemoveFromCollection have an OutArgument of type Boolean, which indicates the result.

Collection Activities
Activity Description
AddToCollection<> Adds an item to a specified collection.
ClearCollection<> Clears all items from a specified collection.
ExistsInCollection<> Returns true if an item exists in a collection.
RemoveFromCollection<> Removes an item from a specified collection and returns true if the item was successfully removed.

For more information, see http://msdn.microsoft.com/en-us/library/vstudio/ee358729(v=vs.100).aspx.

Control Flow

The .NET Framework provides several activities for controlling flow of execution within a workflow. Some of these activities (such as Switch and If) implement flow control structures similar to those in programming environments such as Visual C#, while others (such as Pick) model new programming structures.

Note that while activities such as the Parallel and ParallelForEach activities schedule multiple child activities for execution simultaneously, only a single thread is used for a workflow. Each child activity of these activities executes sequentially and successive activities do not execute until previous activities either complete or go idle. As a result, these activities are most useful for applications in which several potentially blocking activities must execute in an interleaved fashion. If none of the child activities of these activities go idle, a Parallel activity executes just like a Sequence activity, and a ParallelForEach activity executes just like a ForEach activity. If, however, asynchronous activities (such as activities that derive from AsyncCodeActivity) or messaging activities are used, control will pass to the next branch while the child activity waits for its message to be received or its asynchronous work to be completed.

Control Flow Activities
Activity Description
DoWhile Executes the contained activities once and continues to do so while a condition is true.
ForEach<> Executes an embedded statement in sequence for each element in a collection. ForEach is similar to the keyword foreach but is implemented as an activity rather than a language statement.
If Executes contained activities if a condition is true and can execute activities contained in the Else property if the condition is false.
Parallel Executes contained activities in parallel.
ParallelForEach<> Executes an embedded statement in parallel for each element in a collection.
Pick Provides event-based control flow modeling.
PickBranch Represents a potential path of execution in a Pick activity.
Sequence Executes contained activities in sequence.
Switch<> Selects one choice from a number of activities to execute, based on the value of a given expression.
While Executes contained activities while a condition is true.

For more information about the classes, methods, and properties associated with each activity, refer to http://msdn.microsoft.com/en-us/library/vstudio/ee358737(v=vs.100).aspx.

Error Handling

The .NET Framework provides several system-provided activities for implementing error handling and recovery.

Error Handling Activities
Activity Description
Rethrow Rethrows the last exception thrown from within a TryCatch activity.
Throw Throws an exception.
TryCatch Implements exception handling.

For more information, see http://msdn.microsoft.com/en-us/library/vstudio/ee358726(v=vs.100).aspx.

State Machine

The .NET Framework provides several system-provided activities and activity designers for creating state machine workflows.

State Machine Activities
Activity Description
FinalState Represents a terminating state in a state machine. FinalState is an activity designer that when used creates a State preconfigured as a terminating state. For more information, see FinalState Activity Designer.
State Represents a state in a state machine.
StateMachine Executes contained activities using the familiar state machine paradigm.
Transition Represents the transition between two states. There is no Toolbox item for Transition; transitions are created on the workflow designer by dragging and dropping a line between two states, or by dropping a state on the triangles that appear when one state is hovered over another.

For more information, see http://msdn.microsoft.com/en-us/library/vstudio/gg983475(v=vs.100).aspx.

Flowchart

The .NET Framework provides several system-provided activities for controlling execution and branching within a Flowchart.

Flowchart Activities
Activity Description
Flowchart Executes contained activities using the familiar Flowchart paradigm.
FlowDecision A specialized FlowNode that provides the ability to model a conditional node with two outcomes.
FlowSwitch<> A specialized FlowNode that allows modeling a switch construct, with one expression of a type defined in the activity’s type specifier and a single outcome for each match.

For more information, see http://msdn.microsoft.com/en-us/library/vstudio/ee358753(v=vs.100).aspx.

Messaging

Messaging activities allow workflows to send and receive WCF messages. By adding messaging activities to a workflow you can model any arbitrarily complex message exchange patterns (MEP).

Messaging Activities
Activity Description
CorrelationScope Creates and configures a CorrelationScope activity that provides implicit management of child messaging activities with a CorrelationHandle object.
InitializeCorrelation Creates and configures an InitializeCorrelation activity that is used to initialize correlation without sending or receiving a message.
Receive Creates and configures a Receive activity that receives a message from a service.
ReceiveAndSendReplyFactory Creates a pre-configured pair of Send and ReceiveReply activities within a Sequence activity.
Send Creates and configures a Send activity that sends a message to a service.
SendAndReceiveReplyFactory Creates a pre-configured pair of Receive and SendReply activities within a Sequence activity.
TransactedReceiveScope Creates and configures a TransactedReceiveScope activity which enables the flow of transactions into a workflow.

For more information, see http://msdn.microsoft.com/en-us/library/ee829543(v=vs.110).aspx.

Primitives

The .NET Framework provides several system-provided activities that provide a convenient mechanism for performing common tasks.

Activities for Primitives
Activity Description
Assign Assigns a value to a variable at the current scope.
Delay Puts one path of execution into an idle state, possibly allowing the workflow to be unloaded.
InvokeDelegate Executes a delegate that derives from ActivityDelegate and is exposed as a property.
InvokeMethod Executes a public method of a CLR object.
WriteLine Writes a specified string to the console or a specified TextWriter object.

For more information, see http://msdn.microsoft.com/en-us/library/vstudio/ff742828%28v=vs.100%29.aspx.

Runtime

The .NET Framework provides several system-provided activities for accessing the features of the workflow runtime, such as persistence and termination.

Runtime Activities
Activity Description
NoPersistScope A container activity that prevents child activities from persisting.
Persist Explicitly requests that the workflow persist its data to a durable storage medium (i.e., writing to a file).
TerminateWorkflow Terminates the running workflow instance.

For more information, see http://msdn.microsoft.com/en-us/library/vstudio/ee358752(v=vs.100).aspx.

Transaction

The .NET Framework has several system-provided activities for modeling transactions, compensation, and cancellation. These programming models allow the workflow to continue forward progress in the event of changes in business logic and error handling.

Transaction Activities
Activity Description
CancellationScope Associates cancellation logic, in the form of an activity, with a main path of execution, also expressed as an activity.
CompensableActivity Supports compensation of its child activities.
Compensate Explicitly invokes the compensation handler of a CompensableActivity.
Confirm Explicitly invokes the confirmation handler of a CompensableActivity.
TransactionScope Demarcates a transaction boundary.
TransactedReceiveScope Scopes the lifetime of a transaction that is initiated by a received message. The transaction may be flowed into the workflow on the initiating message or created by the dispatcher when the message is received.

Note: The TransactedReceiveScope is located in the Messaging section of the Toolbox.

For more information, see http://msdn.microsoft.com/en-us/library/vstudio/ee358756(v=vs.100).aspx.