Chapter 2 – Built-in Flow Control Activities (Part 2)

MS WFF 4.0 Cookbook (P.63) 02/17/2011, 10:01PM

Using the Switch<T> activity in Sequence workflow

New Workflow Console application, “UsingSwitchActivityInSequenceWorkflow”.


Using the FlowSwitch<T> Activity

New Workflow Console Application, “UsingFlowSwitchActivity”.

Drag a flowchart to WF Designer, and a FlowSwitch. You will be asked to select a type, select String

For erach of the case, define the case value, and whether it’s a default value

Clicko in the FlowSwitch and define the “Expression” (or default input value)

The “Type Selector” is just a way to let you pick which data type this FlowSwitch will be working on.

If you have only two decision path (True/False, Yes/No), then use FlowDecision; else, use FlowSwitch.

Using the Parallel Activity

New Workflow Console app, “UsingParellelActivity”.
Drag a Parallel ontoWF Designer.

You can drag two or more Sequences into the Parrall.

Multiple sequences can run at the same time. Still on single thread.


Using the ParallelForEach<T> Activity

ParallelForEach<T> is a special version of ForEach<T> activity. Difference:

e.g., integer array {1, 2, 3}

ForEach: 1 à 2 à 3
ParallelForEach: process 1 and 2 and 3 at the same time.

Using the Pick Activity

Similar to Listen activity in WF3. Will execute one of its parallel subactivities, and only one of its activities will be executed before the Pick activity completes.

New Workflow Console Application, “UsingPickActivity”.

Drag a Pick activity and two activities (Branch) automatically added:

Both branch will execute parallel, but if Branch 1 compeltes first, Branch 2 will be cancelled.

Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: