Understanding Enterprise Transaction Services in .NET

Transactions are the set of operations which either all result in success or all in failure. Their main feature is that these operations don’t update the data sources permanently until all the operations reach the successful completion state. When all the operations of a transaction get completed transaction is called committed.

Transactions are characterized by their ACID properties which are Atomicity, Consistency, Isolation and Durability. Because of atomicity either all the updates done by the operations are done permanent or none at all. Consistency ensures that the state of the system after the transaction should be consistent as before.


Isolation ensures that the intermediate state of a transaction should remain hidden from the outside i.e. you cannot see the interim data state in a transaction from outside of the transaction. Durability is the characteristic of transaction by virtue of which system remains in the consistent state even the system crashes in between.

Traditional methods for transactions programming in .NET were explicit transaction management and declarative transaction management. In the first one programmer has to start and mange the transaction explicitly. It mainly works where you have to deal with single object interacting with single resource or database and was not very useful in dealing multiple objects interaction with multiple resources.

In declarative transaction programming model there is an abstract class ServicedComponent. All the classes which extend this abstract class are allowed to use the TRANSACTION attribute which informs whether to commit or abort the transaction.

This approach is not flawless too. So in .NET framework version 2.0 a powerful programming model for transactions is introduced which allows easy development of transactional code. This model is implemented in the System.Transactions namespace which has classes like Transaction, TransactionScope, and TransactionManager. In this approach traditional explicit transaction management model is blended with a transaction manager which is known as Lightweight Transaction Manager (LTM).

Now we will discuss some classes defined in System.Transactions namespace. Transaction class is the fundamental one and is mainly used for four purposes. These purposes include obtaining transaction status, aborting transaction, listing transaction resources and defining the isolation level in the transaction.

Actually System.Transactions infrastructure allows us to frame transactional model in both ways: implicit and explicit. Explicit programming model is implemented using the above mentioned Transaction class and implicit model is provided by the class TransactionScope.

It is quite efficient as it makes a piece of code transactional without requiring us to interact with the actual transaction. Next class TransactionMnager consists of methods for handling the transaction management. So .NET has provided rich support for creating transaction services with less burden on developer for writing the transactional code.

_______________________________________________________________________

Add to My Yahoo!


FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

Visit .NET Programming Tutorial Homepage

______________________________________________________

Recommended Resource

| How to Parse an XML Document using DOM | Understanding Code Management in .NET | Understanding Enterprise Transaction Services in .NET | Understanding .NET Interface-Based Programming | Understanding Security Management in Web Services | Understanding SOAP Message and Delivery Structure | Understanding the Basics of Language Integrated Query (LINQ) | Understanding the Basics of Web Services using .NET | Understanding the Basics of XPath |


| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2017 - All Rights Reserved.