Andy's observations as he continues to attempt to know all that is .NET...

Thursday, December 18, 2008

Sql Server 2008 and TransactionScope just got better

Its hard to deny that the TransactionScope programming model created in .NET 2.0 was pretty cool.  Initial feelings when I saw it was wow I can now place transactional directives in the business layer and have everything inside that block right down to the data layer enlist in the transaction.  However disappointment was only just around the corner when you saw that multiple Open/Close pairs inside the same transaction caused the transaction to be promoted to the DTC ( see previous post ) event though you were talking to the same database instance.

There have been many solutions to this problem, all effectively resulting in changing the way your data layer works to maintain an open connection across multiple data access layer calls.  My implementation can be found here, and Alazel Acheson's here

The good news is that this is no longer needed as of Sql Server 2008, the transaction is only promoted when you do indeed involve multiple resources.

No comments:

About Me

My photo
Im a freelance consultant for .NET based technology. My last real job, was at Cisco System were I was a lead architect for Cisco's identity solutions. I arrived at Cisco via aquisition and prior to that worked in small startups. The startup culture is what appeals to me, and thats why I finally left Cisco after seven years.....I now filll my time through a combination of consultancy and teaching for Developmentor...and working on insane startups that nobody with an ounce of sense would look twice at...