What are Activities

Activity Execution Context (AEC)

AEC is the execution environment created for an activity when the Start method is called.

New AECs are created when child activities of an activity are run more than once, thus allowing the various instances to run independently. An activity can close only when it's execution contexts have been completed.

Activity States

Activities move through various stages in the life cycle of the workflow. Various stages of an activity are: Initialized, Executing, Canceling, Closed, Compensating and Faulting.

Windows Workflow Foundation Base Activity Library

Windows Workflow Foundation includes a set of out-of-the-box activities. These are available in the Visual Studio toolbox and ready to be configured to be used.

Following is a listing of some of the commonly used activities

Composite Activities

Conditional Activites

Conditions can be expressed in one of the following ways

Policy activities are a collection of simple rules and enable forward chaining. Forward chaining is the ability of the actions of one rule to cause other dependent rules to be re-evaluated.

State Workflow Activities

The following activities are used for creating State Machine workflows

Event Driven Activites

Abnormal Operation /Error Handling Activities

Transaction

External Operations

Custom Activities

The workflow foundation provides a number of activities out of the box. In any case, as you get into real life development for workflows, you will want to create custom activities, specialized for your requirements. Custom activities can incorporate knowledge on domain specific areas, incorporating vertical business functionality or can be setup as specialized building blocks for the horizontal architecture.

Custom Activities are developed by deriving from the Activity base class or from an activity that derives from the Activity class.

The visual aspect in design as well as execution is the one that differentiates the workflow based applications from other frameworks. The ActivityDesigner and CompositeActivityDesigner base classes provide designer features and these classes or their derived classes can be used for custom activities.

A number of ready to use custom activity samples are available at : http://wf.netfx3.com/files/14/default.aspx

Performance Considerations

Note the following performance considerations when developing your custom activities and/or workflows

Enable Transaction Support, Compensation support and Execution tracking only in areas where required.

Resources

Conclusion

In this article, we took a look at the introductory concepts of Activities in Windows Workflows Foundation. The workflow foundation is full of Activity goodies and custom activity functionality should be the icing on the cake.

Disclaimer:

This article is for purely educational purposes and is a compilation of notes, material and my understanding on this subject. Any resemblance to other material is an un-intentional coincidence and should not be misconstrued as malicious, slanderous, or any anything else hereof.