TransactionScope v SQLTransaction

I found the following quote: β€œIt is recommended that you create implicit transactions using the TransactionScope class” on this website: http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx ; Is the TransacrtionScope SQLTransaction class enabled? ? those. should all new transaction applications / functions use the TransactionScope class? If so, I assume SQLTransaction exists in such a way that legacy applications do not need to be changed?

I have read many web pages that suggested that TransactionScope should be used if multiple connections are used, but should TransactionScope be used if you have a subscription connection that performs several operations that should be considered an atomic unit of work?

+4
source share
1 answer

I personally like transactionScope because your queries to your database do not require a parameter for sqlTransaction (or connection) or other related code to support the transaction. This usually allows your service / business word to completely manage the transaction, which for me just reads cleaner.

+1
source

Source: https://habr.com/ru/post/1495509/


All Articles