.NET TransactionScope 类和 T-SQL TRAN COMMIT 和 ROLLBACK

.NET TransactionScope class and T-SQL TRAN COMMIT and ROLLBACK(.NET TransactionScope 类和 T-SQL TRAN COMMIT 和 ROLLBACK)
本文介绍了.NET TransactionScope 类和 T-SQL TRAN COMMIT 和 ROLLBACK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我目前正在编写一个应用程序,该应用程序需要为我的业务实体进行多次插入、更新和删除操作.我使用 TransactionScope 类来保证所有存储过程都可以作为单个工作单元提交或回滚.

I am current writing an application that will require multiple inserts, updates and deletes for my business entity. I am using the TransactionScope class to guarantee all the stored procedures can commit or roll back as a single unit of work.

我的问题是,如果我在我的 .NET 类库中使用 TransactionScope 类,我还需要使用 COMMIT TRAN 和 ROLLBACK TRAN 是我的每个存储过程吗?

My question is, I am required to also use COMMIT TRAN and ROLLBACK TRAN is each of my stored procedures if I am using the TransactionScope class in my .NET class library?

推荐答案

2005 年不需要,2000 年我会,另外,我通常将事务范围放在使用"块中.

ON 2005 its not necessary, on 2000 I would ,Also, i usually put the transactionscope in a "using" block.

与 2005 相比,在 2000 及更早版本上使用时存在一些性能问题.

There are some performance issues when using it on 2000 and older vs 2005.

参见 这里

谢谢

这篇关于.NET TransactionScope 类和 T-SQL TRAN COMMIT 和 ROLLBACK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
How to store delegates in a List(如何将代表存储在列表中)
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)
CreateDelegate with unknown types(具有未知类型的 CreateDelegate)
Does Funclt;Tgt;.BeginInvoke use the ThreadPool?(Funclt;Tgt;.BeginInvoke 使用线程池吗?)
How to create a delegate to an instance method with a null target?(如何为具有空目标的实例方法创建委托?)