没有 TransactionScope 的 .NET 事务管理
我在我的应用程序中积极使用 TransactionScope 并且很高兴。但现在我遇到了 TransactionScope 不够灵活的情况:首先,因为我无法动态更改 IsolationLevel。
用可以手动管理的数据库事务替换 TransactionScope 的最简单方法是什么?我想保留的功能之一是支持交叉连接交易。
I was actively using TransactionScope in my application and was happy. But now I came to the situation where TransactionScope is not enough flexible: first of all, because I can't change IsolationLevel dynamically.
What is the easiest way to replace TransactionScope by database transaction which can be managed manually? One of the features I want to keep is the support of cross-connections transactions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为结论是你不能这样做:既拥有分布式事务又更改隔离级别。
事务启动后,您无法更改其隔离级别。
要使用交叉连接事务,您需要使用事务范围或通过企业服务的 COM+ 事务。在这两种情况下,您都无法在创建事务后更改隔离级别。
可以使用“设置事务隔离级别”SQL 语句来更改 SQL 连接的隔离级别。
I think that the conculsion is that you cannot do this: Have both a distributed transaction and change the isolation level.
You cannot change the isolation level of a transaction after it has started.
To use cross connection transactons you need to use transaction scope, or a COM+ transaction via enterprise services. In both cases you cannot change the isolation level after the transaction is created.
It is possible to to change the isolation level of a SQL connection using the "set transaction isolation level " SQL statement.