Solved

When to use TransactionOption.Supported

Posted on 2003-12-08
9
576 Views
Last Modified: 2012-06-27
I have a class that requires to be in a Transaction. I therefore have given it the attribute <Transaction(TransactionOption.Required)>
My class also calls methods in other classes which do work that needs to be in the transaction.
Do I have to add an attribute to those classes as well or will they automatically be in the transaction?

If I don't have to, why would any one ever use the TransactionOption.Supported parameter?

0
Comment
Question by:mikexxx
  • 6
  • 3
9 Comments
 
LVL 8

Expert Comment

by:Dranizz
ID: 9897986
Well, if you have many objects in different assemblies that can operate seperatly and together, you can set the transaction object to supported to make them share a transaction if use together.
0
 
LVL 8

Expert Comment

by:Dranizz
ID: 9897998
You don't have to add option for other classes, class called in the method with the attribute will be in the transaction, if any fails and exception is thrown, than the transaction fails for all and rollbacked, if no exception is thrown, then trnsaction is commited for all.
0
 
LVL 8

Expert Comment

by:Dranizz
ID: 9903727
Is that good enougth?
0
 

Author Comment

by:mikexxx
ID: 9903803
I don't think you are correct. I have just created a transaction and called a method in another DLL. When I throw an exception, everything rolls back. The transaction must be containing what was done in the other DLL.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 8

Expert Comment

by:Dranizz
ID: 9903839
what option did you use?
0
 

Author Comment

by:mikexxx
ID: 9903861
I created the transaction by having the attribute <Transaction(TransactionOption.Required)>  on the class which inherited ServicedComponent .
The class in the DLL did not inherit ServicedComponent or have any relavent attributes.
0
 
LVL 8

Expert Comment

by:Dranizz
ID: 9903868
Yeah, that's what I told you.
"if any fails and exception is thrown, than the transaction fails for all and rollbacked,"

Everything shares the transaction in the method where you specify the transaction option. With supported, if a transaction is already started then it shares it.

With requiredit shares a transac it exist or create one if not.
With requirednew it creates a root transac.

0
 

Author Comment

by:mikexxx
ID: 9903892
Yes but I was calling stuff in another assembly, without the TransactionOption.Supported
 and yet it still was contained within the transaction.

Since this is the case, my question is, why would I ever need to specify TransactionOption.Supported since it is the default.

0
 
LVL 8

Accepted Solution

by:
Dranizz earned 250 total points
ID: 9904148

In my MCSD book, it says that the configured default value is Required with and IsolationLevel Serializable.
and the unconfigured default value is false.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cossdk/htm/pgservices_transactions_9oj7.asp
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now