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:
Post a Comment