Chapter 7. Transactions

Transactions are the key to building robust, high-quality applications. WCF provides simple, declarative transaction support for service developers, enabling you to configure parameters such as enlistment and voting, all outside the scope of your service. In addition, WCF allows client applications to create transactions and to propagate transactions across service boundaries. This chapter starts by introducing the problem space transactions address and the basic transactions terminology, and then discusses the support for transactions and transaction management offered by WCF and .NET. The rest of the chapter is dedicated to transactional programming models, both for services and clients, and to how transactions relate to other aspects of WCF, such as instance management and callbacks.

The Recovery Challenge

Proper error handling and recovery is the Achilles’ heel of many applications. When an application fails to perform a particular operation, you should recover from it and restore the system—that is, the collection of interacting services and clients—to a consistent state (usually, the state the system was at before the operation that caused the error took place). Operations that can fail typically consist of multiple potentially concurrent smaller steps. Some of those steps can fail while others succeed. The problem with recovery is the sheer number of partial success and partial failure permutations that you have to code against. For example, an ...

Get Programming WCF Services, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.