Compensable Activity Sample

This topic applies to Windows Workflow Foundation 4 (WF4).

This sample demonstrates how to use the CompensableActivity activity to define the work to be done for a given action during normal execution and the work that is necessary to be done to compensate that action, if necessary at a later time. The first part of the sample shows how units of compensable work can be defined in Windows Workflow Foundation (WF) using a CompensableActivity activity and how they are executed in a successful run. The second part of the sample shows how the same units of compensable work automatically take care of compensation when an unexpected event is hit and the workflow instance is canceled.

To set up, build, and run the sample

  1. Using Visual Studio 2010, open the CompensableActivity.sln.

  2. Build the solution by pressing CTRL+SHIFT+B.

  3. Run the application by pressing F5.

Dd483327.Important(en-us,VS.100).gif Note:
The samples may already be installed on your machine. Check for the following (default) directory before continuing.

<InstallDrive>:\WF_WCF_Samples

If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.

<InstallDrive>:\WF_WCF_Samples\WF\Basic\Compensation\BasicCompensableActivity