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 compensation by using Compensable activity

Imagine a scenario where we are buying a computer online and money has been deducted from our bank account. Suddenly an unexpected exception occurs, workflow stops, and the purchase gets cancelled. Obviously, such a thing should not happen in real life. If an exception occurs that induces workflow stop, the money should be returned back to our account. In WF4 we can use a Compensable activity to handle such a compensation job.

How to do it...

  1. Create a Workflow Console Application project:

    Create a new Workflow Console application project and name it UseCompensableActivity.

  2. Create workflow code:

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

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