Multiple Connections With Same Connection String U

2019-01-27 01:42发布

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.

1条回答
疯言疯语
2楼-- · 2019-01-27 02:13

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.

查看更多
登录 后发表回答