1

我们在设置MSDTCSystemTransactions时经常遇到一些问题,现在正在考虑用SqlTransactions.

我对上述差异以及我们可能遇到的问题感兴趣。

4

2 回答 2

1

The article quoted and referenced by Massimiliano was 7 years old when referenced and therefore refers only to .NET 2.0 and SQL Server 2000 and 2005. However, I believe the salient points are still valid for later versions. I'm having trouble finding directly applicable commentary on any changes in later versions.

It does seem that in SQL Server 2008 and later System.TransactionScope transactions against a single database are less likely to be promoted to DTC than under older versions.

related: SqlClient, System.Transactions, SQL Server 2008, and MARS

So depending on you SQL Server version you will have more or less trouble with DTC using System.Transactions against a single database.

The code for System.Transactions is lighter than for SqlTransactions, but the processing overhead is higher and you have less explicit control.

于 2013-01-10T17:17:08.063 回答
0

System.Transactions 不是SqlTransaction. _

但就单个数据库而言,基于 ADO.NET 2.0 System.Transactions 的事务与常规 SqlTransaction 之间的最大区别在于“隔离级别”。然而,这是一个很大的区别。稍后让我谈一谈隔离级别,但在此之前您必须意识到,在 Sql 2k 中,即使您涉及一个单一的数据库,事务也将由 MSDTC 管理。对于 Sql2k5,事务由 LTM 管理,直到连接到不同数据库的第二个 SqlConnection 出现。当这种情况发生时,事务就会从 LTM 提升到 MSDTC。

http://dotnetslackers.com/SQL/re-3463_SqlTransaction_vs_System_Transactions.aspx

于 2012-08-28T10:28:33.343 回答