Using the CompensatableSequence Activity

The preceding section might leave you wondering why the Compensate activity exists. After all, you can’t nest compensated transactions. You can’t nest any type of WF-based transaction.

But let’s look at it in a different way. How would you tie two compensatable transactions together so that the failure of one triggers compensation in the other, especially if the other already completed successfully? The answer is you pair the compensated transactions in a single instance of the CompensatableSequence activity. Then, in the compensation or fault handler for the CompensatableSequence activity, you trigger compensation of both child transactional scope activities if either one of them fails. Even more interesting ...

Get Microsoft® Windows® Workflow Foundation Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.