Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
805 views
Welcome To Ask or Share your Answers For Others

1 Answer

No, you don't need explicit transactions if using TransactionScope for your transactions - however: important you should probably set Transaction Binding=Explicit Unbind; in the connection string. The full details are here, but otherwise you can end up with the first few operations getting rolled back, and the last few committing (or rather, running outside of any transaction).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...