加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

.net – TransactionScope:它变得更好了吗?

发布时间:2020-12-16 00:10:45 所属栏目:asp.Net 来源:网络整理
导读:当TransactionScope首次出现时,我遇到了一些严重的问题,让它在我的开发机器(XP)和我们的数据库服务器(Windows Server 2003)之间工作. 当我更多地研究它时,这似乎是一个棘手而广泛的问题,有可能成为生产中的头疼,所以我决定不以这种方式处理事务(即使我很喜欢
当TransactionScope首次出现时,我遇到了一些严重的问题,让它在我的开发机器(XP)和我们的数据库服务器(Windows Server 2003)之间工作.

当我更多地研究它时,这似乎是一个棘手而广泛的问题,有可能成为生产中的头疼,所以我决定不以这种方式处理事务(即使我很喜欢语法,我真的想要它上班).

这些问题是否仍然存在或者使用安全吗?你现在经常使用这个没有问题吗?

非常感谢!

注意:现在已经很久了,但我认为这个问题与Distribute Transaction Coordinator有关.我摆弄了很长时间,但却从来没有能够让它发挥作用.

解决方法

Rick Strahl有一篇关于事务范围和LINQ to SQL here的文章.它的上下文更多是LINQ to SQL,但我认为有一些原则可以帮助你解决问题.

编辑:更具体地回答你的问题,这是Strahl对TransactionScope的评价:

Traditionally TransactionScope was a .NET wrapper around the Distributed Transaction Coordinator (DTC) but it’s functionality has expanded somewhat. One concern is that the DTC is rather expensive in terms of resource usage and it requires that the DTC service is actually running on the machine (yet another service which is especially bothersome on a client installation).

However,recent updates to TransactionScope and the SQL Server Client drivers make it possible to use TransactionScope class and the ease of use it provides without requiring DTC as long as you are running against a single database and with a single consistent connection string

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读