Writing a Transactional Application
As a transactional application programmer, you can take advantage of the two programming models provided by the System.Transactions namespace to create a transaction. You can utilize the explicit programming model by using the Transaction class, or the implicit programming model in which transactions are automatically managed by the infrastructure, by using the TransactionScope class.. It is recommended that you use the implicit transaction model for development. You can find more information on how to use a transaction scope in the Implementing an Implicit Transaction using Transaction Scope topic.
Both models support committing a transaction when the program reaches a consistent state. If the commit succeeds, the transaction is durably committed. If the commit fails, the transaction aborts. If the application program cannot successfully complete the transaction, it attempts to abort and undo the transaction's effects.
In This Section
Creating a Transaction
The System.Transactions namespace provides two models for creating a transaction. These models are covered in the following topics.
Describes how the System.Transactions namespace supports creating implicit transactions using the TransactionScope class.
Describes how the System.Transactions namespace supports creating explicit transactions using the CommittableTransaction class.
Escalating Transaction Management
When a transaction needs to access a resource in another application domain, or if you want to enlist in another durable resource manager, the transaction is automatically escalated to be managed by the MSDTC. Transaction escalation is covered in the Transaction Management Escalation topic.
The topic Interoperability with Enterprise Services and COM+ Transactions illustrates how you can make your distributed transactions interact with COM+ transactions.
Diagnostic Traces describes how you can use the trace codes that are generated by the System.Transactions infrastructure to troubleshoot errors in your applications.
Working within ASP.NET
The Using System.Transactions in ASP.NET topic describes how you can successfully use System.Transactions inside an ASP.NET application.
Copyright © 2007 by Microsoft Corporation. All rights reserved.