Transactions in .Net
We talked about Transactions in .Net a few days back... We learnt that how
they can be automatic or manual...Now ,we will talk about Automatic
Transactions this whole week... Hopefully it will be interesting and
useful...
Automatic Transaction manages transaction boundaries for you... But again it
manages the boundaries on the basis of what you suggest it to do (you do
that by attributes which we will talk in a couple of days... ) The
transaction flows from one object to other as instructed... Within its
scope, it includes, the objects that are suppose to participate in
transactions and leaves out the objects that are not suppose to
participate...
Note: Nested transactions are not possible in Automatic model...
---------xxxxxx--------------------
Transaction Attribute for your class
We discussed that for our class to participate in transactions we need to do
certain things... Now we will talk about what those certain things have to
be...
One of the things that you need to do is to apply Transaction attribute to
your class... You would apply it just before your class declaration... It
would look something like:
[Transaction(TransactionOption.Supported)]
Now if you are familiar with COM+ transactions then TransactionOption has
values which are very similar to COM+ transaction options...
The TransactionOption values can be Disabled, NotSupported, Supported,
Required, RequiresNew... Out of these Required is the default...
With Best Regards
Mitesh Mehta
eMAIL : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta
2 comments:
TransactionOption
We are getting into the details of TransactionOption today...
1. TransactionOption.Disabled implies that automatic transactions cannot control the object... Still if you want this object to support transaction then it can be done by manual transactions...
2. TransactionOption.NotSupported implies that object context will always be created without transaction for this object no matter whether a transaction is already existing...
3. TransactionOption.Supported implies that if transaction exists the object will run under it, if it does not exist it will run without transaction...
4. TransactionOption.Required implies that if transaction exists the object will run under it, if it does not exist a new transaction will be created...
With Best Regards
Mitesh V. Mehta
email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Transactions in .Net - Using Services of COM+
To use the services of COM+ and transactions you need to register the assembly that contains you class (transactional) with the COM+... You can do so manually by using .Net Services Installation Tool (Regsvcs.exe)... Well if your client is managed client then you do not need to do this registration as CLR will do it for you but if you know that at sometime your clients can be unmanaged then it is always useful to register your assembly manually...
With Best Regards
Mitesh V. Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/
Post a Comment