Solved

When to use TransactionOption.Supported

Posted on 2003-12-08
9
589 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

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
 
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

726 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