
Understanding Enterprise Transaction Services in .NETTransactions are the set of operations which either all result in success or all in failure. Their main feature is that these operations dont 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.
_______________________________________________________________________
FREE
Subscription
Subscribe
to our mailing list and receive new articles Note
: We never rent, trade, or sell my email lists to Visit
.NET Programming Tutorial Homepage ______________________________________________________ |