的TransactionScope或IDbTransaction [英] Transactionscope or IDbTransaction

查看:310
本文介绍了的TransactionScope或IDbTransaction的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:我只访问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.

这篇关于的TransactionScope或IDbTransaction的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆