問題描述
我目前正在編寫一個(gè)應(yīng)用程序,該應(yīng)用程序需要為我的業(yè)務(wù)實(shí)體進(jìn)行多次插入、更新和刪除操作.我使用 TransactionScope 類來保證所有存儲過程都可以作為單個(gè)工作單元提交或回滾.
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 是我的每個(gè)存儲過程嗎?
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 年我會,另外,我通常將事務(wù)范圍放在使用"塊中.
ON 2005 its not necessary, on 2000 I would ,Also, i usually put the transactionscope in a "using" block.
與 2005 相比,在 2000 及更早版本上使用時(shí)存在一些性能問題.
There are some performance issues when using it on 2000 and older vs 2005.
參見 這里
謝謝
這篇關(guān)于.NET TransactionScope 類和 T-SQL TRAN COMMIT 和 ROLLBACK的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!