的TransactionScope或IDbTransactionTransactionScope、IDbTransaction

由网友(穿着校服逛坟场)分享简介:编辑:我只访问1数据库,但DTC事务正在创建。我可以看到它在DTC事务列表界面(组件服务的插件)。这是为什么?I am only accessing 1 database but a DTC transaction IS being created. I can see it in the DTC Transactio...

编辑:我只访问1数据库,但DTC事务正在创建。我可以看到它在DTC事务列表界面(组件服务的插件)。这是为什么?

I am only accessing 1 database but a DTC transaction IS being created. I can see it in the DTC Transaction List GUI (Component services plugin). Why is this?

我要对1的数据库进行交易(几个插入命令)。

I need to perform a transaction (several insert commands) against 1 database.

我应该使用的TransactionScope或IDbTransaction(connection.BeginTransaction)?

Should I be using TransactionScope or IDbTransaction (connection.BeginTransaction)?

的TransactionScope似乎是新的......但它应该只是用于2阶段提交?

TransactionScope seems to be newer … but should it just be used for 2-phase commits?

感谢

推荐答案

的TransactionScope只能升级到分布式事务,如果它检测到多个连接。这意味着,TransactionScope的仅仅是为轻量的BeginTransaction本地交易和TransactionScope的是一个更容易使用。

TransactionScope will only escalate to a distributed transaction if it detects more than one connection. This means that TransactionScope is just as lightweight as BeginTransaction for local transactions and TransactionScope is a lot easier to use.

阅读全文

相关推荐

最新文章