O'Reilly logo

Microsoft Windows Workflow Foundation 4.0 Cookbook by Andrew Zhu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performing manual compensation by using Compensate activity

In a certain workflow execution phase, we may want to compensate an activity manually (rather than driven by an exception/error)—a Compensate activity will handle this job.

How to do it...

  1. Create a Workflow Console Application project:

    Create a new Workflow Console Application and name it UseCompensateActivity .

  2. Create workflow code:

    Add a new class file to the project and name it CompensationWorkflow.cs. Fill the file with the following code:

    using System; using System.Activities; using System.Activities.Statements; namespace UseCompensateActivity { class CompensationWorkflow { public Activity GetInstance() { Variable<CompensationToken> token=new Variable<CompensationToken>(); Activity workflow ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required