views:

761

answers:

1

When using ado.net, and creating multiple connections to a MS SQL Server database within a single transaction (using System.Transactions.TransactionScope), does System.Transactions elevate the transaction from the lightweight transaction manager to the distributed transaction coordinator (kernel transaction coordinator on Vista), even if the connection strings are the same for all of the connection objects?

The documentation is somewhat ambiguous on this specific situation. It says the transaction will get elevated if another connection is opened to the server during the transaction but it doesn't say if it does that all the time or only if the connection string is different. It doesn't make sense to me that it would elevate the transaction if the connection string is the same, but if it does, it basically makes the lightweight transaction manager completely useless, IMO.

+2  A: 

In the current version it always elevates the transaction, unfortunately.

Which as you say, makes TransactionScope a lot less useful than it otherwise would be. I believe there are plans to change this in a future version.

Joe
Ugh, that sucks. Do you have any strategies for circumventing this "feature?" My only guess is to keep a session-level (not necessarily via the Session object) connection object open during a user request and defer all calls through one's data access layer to use it. I'm gonna start another question
Robert C. Barth