Update: 6/24 – updated sample to show how unhandled exceptions and the UnhandledException delegate impact this activity
Nearly a year ago I created a CancellationScope Activity sample and posted it on CodeGallery for .NET 4 Beta 1. I went back yesterday and updated it for .NET 4 RTM – the sample has some interesting points to demonstrate.
It shows how the CancellationScope Activity works but it also shows
You can download the sample from http://code.msdn.microsoft.com/wf4CancellationScope
How do you cancel work in your application? Many middle tier components and services rely on transactions to handle cancellation for them. This makes a great deal of sense because transactional programming is well understood. However there are many times when you must cancel work that cannot be done under a transaction. Cancellation can be very difficult because you have to track work that has been done to know how to cancel it. WF4 also includes compensation activities that can be used to do clean up work as well. Windows Workflow Foundation 4 helps you with this by providing a CancellationScope activity. In today’s example I’m going to show you how you can use a cancellation scope to manage cleanup work.
This sample also includes a unit test project CancelScope.Tests that you can study to see how we tested this sample application
Nearly a year ago I created a CancellationScope Activity sample and posted it on CodeGallery for .NET