Another Way of Doing Transactions in .NET

I was browsing today, and ran into this question on doing transactions in Sql Server.  Since I was familiar with using SqlTransactions, I thought maybe it was a question I could provide an answer to, but then I saw the response by Anders Abel about TransactionScope.  Wow!  I had never known this existed and it seemed like a much better way of doing transactional operations without getting into SqlTransaction.

However, Remus Rusanu, commented on Anders’ answer, however, suggesting that this wasn’t the best way to use TransactionScope.  He pointed to a blog post by a Microsoftie that gave serious caution to using it “straight up” without some modification.  I had a look at the article and I was really excited about using TransactionScope with that technique.  I can think of a few places it might have saved me some grief in the past.  And I’m posting a link to the MSDN article, “using new TransactionScope() Considered Harmful” here, mainly for my personal future use, but YOU, dear reader, might find this valuable too.  So here it is:

using new TransactionScope() Considered Harmful by David Baxter Browne

Enjoy coding!

This entry was posted in Coding. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s