first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

MCAD/MCSD Notes: Chapter 5, Lesson 3; Processing Transactions

Lesson 3: Processing Transactions

The purpose of this lesson is to recognize the existence of functionality in the .NET framework that can be considered transactional. However, it is clear that "real" (distributed) transactions are covered only by COM+ Enterprise Services. So the transaction features of ADO.NET 1.x are confined to a single connection object. The .NET Framework 2.0 context introduces the System.Transactions namespace. For more information please see "ADO.NET and System.Transactions" by John Papa here:

http://msdn.microsoft.com/msdnmag/issues/05/02/DataPoints/default.aspx

ACID stands for Atomic, Consistent, Isolated and Durable. For more details please see "The ACID Test: A mini database tutorial for those that are interested..." by John Parker here:

http://www.archwing.com/technet/technet_ACID.html

ADO.NET 1.x handles transactions implicitly and explicitly. DataSet methods Update(), RejectChanges() and AcceptChanges() imply transactional processing. Use of the SqlTransaction, OracleTransaction and OleDbTransaction objects explicitly handle transactions against one database connection. These transaction objects are obtained from the BeginTransaction() method of the connection object. Once the transaction object is obtained, the Commit() and Rollback() methods are used to design a transaction.

Command objects are associated with a connection. When a connection begins a transaction, all command objects referencing that connection must have their Transaction property set. An important quote from "Best Practices for Using ADO.NET" by Dennis Lu and Doug Rothaus: "If the Command.Transaction property is not set to a Transaction that has been started for the associated Connection, the Command fails and an exception is thrown." For more information see:

http://msdn.microsoft.com/library/en-us/dnadonet/html/adonetbest.asp

The Transaction attribute of the @Page directive starts a new transaction. The static methods of the System.EnterpriseServices.ContextUtil class are used to commit or abort MTS (or MS DTS) transactions in ASP.NET pages. These static methods are SetComplete() and SetAbort() (which correspond to Page events CommitTransaction() and AbortTransaction() respectively). For more information see "MTS Transactions" here:

http://samples.gotdotnet.com/quickstart/aspplus/doc/mtstransactions.aspx
mod date: 2005-05-24T20:49:19.000Z