TransactionScope的选择对象不DTC对象、TransactionScope、DTC

由网友(风中一匹马)分享简介:有什么替代的TransactionScope这并不需要启用DTC ?? 在交易我需要两个操作:创建一个用户(使用成员 - SQL成员资格提供)请一个插入操作。解决方案 的TransactionScope使用LTM - 在.net轻量级事务管理器。只有当你打开在同一事务中多个连接或数据库之间的走,要的Transac...

有什么替代的TransactionScope这并不需要启用DTC ??

在交易我需要两个操作:

创建一个用户(使用成员 - SQL成员资格提供) 请一个插入操作。 解决方案

的TransactionScope使用LTM - 在.net轻量级事务管理器。只有当你打开在同一事务中多个连接或数据库之间的走,要的TransactionScope促进交易的2PC型TX-经理,DTC。

有关MS SQL Server 2008和以上时,DTC将参与只有当您打开到的不同的的DB的连接。或者如果你是除非你使用的是打开的连接从多个线程在同一交易 DependentTransaction 这是你应该在全球事务中登记,如果你想要做的线程。

作为一个侧面一点:我有在 Castle.Transactions

端点#2:如果您使用的TransactionScope,一定要显式声明的IsolationLevel否则你序列化您的所有交易(IsolationLevel.Serializable)

C 分布式事务的解决方案之TransactionScope

are there any alternative to transactionScope which does not need to enable DTC??

In the transaction I need to make two operations:

Create one user (using membership - sql membership provider) Do one insert operation.

解决方案

TransactionScope uses the LTM - Lightweight Transaction Manager in .Net. Only if you open more than one connection in the same transaction or go between databases, should TransactionScope promote the transaction to the 2PC-based TX-manager, DTC.

For MS SQL Server 2008 and above, the DTC will become involved only if you are opening connections to different DBs. OR if you are opening connections in the same transactions from multiple threads EXCEPT if you are using DependentTransaction which is what you should enlist in your global transaction if you want to do threading.

As a side-point: I have some support for the multi-threading story in Castle.Transactions.

Side-point #2: If you use TransactionScope, make sure to declare the IsolationLevel explicitly otherwise you're serializing all your transactions (IsolationLevel.Serializable)!

阅读全文

相关推荐

最新文章