All or nothing - this is the main feature of a transaction. When writing a few records - either all are written, or everything will be undone. If there is just one failure when writing one records, all the other things that are done within the transaction are rolled back.
Transactions are commonly used with databases, but with classes from the namespace System .Transactions you can also perform transactions on volatile or in-memory based objects such as a list of objects. With a list that supports transactions, if an object is added or removed and the transaction fails, the list action is automatically undone. Writing to a memory-based list can be done in the same transaction as writing to a database.
In Windows Vista, the file system and registry also get transactional support. Writing a file and making changes within the registry supports transactions.
In this chapter, the following topics on transactions are covered:
Overview
Traditional transactions
Committable transactions
Transaction promotions
Dependent transactions
Ambient transactions
Transaction isolation level
Custom resource managers
Transactions with Windows Vista