Last post Jul 18, 2011 06:13 PM by jportelas
Jul 09, 2008 11:54 AM|koraykazgan|LINK
I have an ASP.Net 2.0 Web Application and am using SQL Server 2005. In my application I have a data layer. In my data layer I have methods like SavePerson(), SaveAdress(), SaveOffice(), etc. In each of these methods a new connection is created, a transaction
is created, the command is executed and if everything works well the transaction is commited.
So far so good. But now I have the following requirement. I have to call these methods, while another transaction is created: So I need nested transactions. I have googled a bit and saw that there is a class called TransactionScope, which can handle nested
transactions. But I also read on many sites, that it is very slow compared to SqlTransaction, especially when there are lots of requests from lots of users.
So I am asking if there is an alternative to TransactionScope? Shall I use it, even performance is important for me? I also thought of checking in each data method, if a transaction is existing. If not, to create one, and if it exists, to use the existing
one. But to do this check in each method is not nice.
I hope you can give me suggestions!
Jul 14, 2008 02:27 AM|Wencui Qian - MSFT|LINK
The Transactions infrastructure provides both an explicit programming model based on the
Transaction class, as well as an implicit programming model using the
TransactionScope class, in which transactions are automatically managed by the infrastructure. It is
recommended that you create implicit transactions using the
TransactionScope class, so that the ambient transaction context is automatically managed for you. As far as I know, it don't think it has low performance as you metioned. It has the same capability with usual Transaction class but has a better program
For more information, please refer this link:
Jul 14, 2008 03:09 AM|koraykazgan|LINK
this was the information I needed. Thank you very much...
Jul 18, 2011 06:13 PM|jportelas|LINK
And finally, did it work for you? I mean.. was TransactionScope what you needed?
no complaints from clients...
Thanks for the feed back.