2 minute read

EnterpriseServices and transaction promotion.

[_ Greg_](http://www.rassoc.com/gregr/weblog/2002/11/30.html#a98)_ didn't really like my previous example and says that one could easily pass the SqlTransaction to a method, thereby eliminating the need for implicit distributed transactions[...]_ > >

ThisEnterpriseServicesdiscussionhas been timely for me. One of the projects that I’ve been working on over the last couple of months involves building declarative SQL Server transactions to give you the advantage of attributed programming that you get with ES while avoiding the DTC.

I spent some time over the last week writing up a description of my implicit transaction code so I will try my best to make time to publish the first part of this tomorrow.

_Definitely true - at the first look. But what happens, if you later decide that you need distributed TX, probably because another method wants to integrate the addition of a new customer with a post to a message queue? This wouldn't be possible using the code you've shown. (And I'm not even talking about what happens if some method somewhere deep down the call chains screws up the transaction logic by preliminary committing a TX)._ > >

For a whole class of web applications that I’ve been involved in over the last few years using primarily VB6/ASP, we only used COM+ for the simplification of the transaction processing model. Although in 99% of the cases we only ever used SQL Server, along the way, perhaps with diminishing frequency, I’ve oft cited the fact that one day we’ll need the DTC and we’ll be glad we used COM+ transactions then but I don’t think it’s ever happened to me yet.

_On the other hand, your point regarding the overhead of distributed TX is well understood. Wouldn't it be great if EnterpriseServices would allow for transactions to start as local ones and later be turned into distributed TX "on demand" - as soon as you access a secondary resource manager? In fact, this feature is planned for the future and the only reason I didn't talk about it before was that I thought it was NDA information. I was wrong - it is already in public and can be found at _[](http://www.gotdotnet.com/team/xmlentsvcs/esfaq.aspx#5.2)[_http://www.gotdotnet.com/team/xmlentsvcs/esfaq.aspx#5.2_](http://www.gotdotnet.com/team/xmlentsvcs/esfaq.aspx#5.2)_  (next to some other great information about this topic)._ > >
_In the future, Enterprise Services will support the concept of promotable transactions which will begin as a local transaction and will be promoted to a distributed transaction when required._ >> >>
> > _Pretty cool, huh? Hearing about this feature was definitely part in triggering my love for this technology._ [[Ingo Rammer's DotNetCentric](http://www.dotnetremoting.cc/DotNetCentric/)] > >

This is something that I didn’t know. Yes, it is pretty cool, and I can certainly understand how it might cast ES in a different light. I need to think carefully about how this affects my thought processes thus far :o).

Updated: