tags:

views:

49

answers:

2
+2  Q: 

TransactionScope

Hello All!

Please help me!

Wich are the good and bad sides of TransactionScope object in C#?

Thanks.

+1  A: 

Good side:

Can do transactions beyond database context. Insert record into db. Write file to disk.

Bad side:

Requires MSDTC access on client machine, where TransactionScope is used.

this. __curious_geek
Doesn't it only require access when you connect to 2 or more different servers? It starts off lightweight then upgrades itself.
Adam
+1  A: 

Some advantages from MSDN :

TransactionScope Benefits

  • The code inside the transactional scope is not only transactional, it is also promotable. The transaction starts with the LTM and System.Transactions will promote it as required, according to the nature of its interaction with the resources or remote objects.
  • The scope is independent of the application object model—any piece of code can use the TransactionScope and thus become transactional. There is no need for special base class or attributes.
  • There is no need to enlist resources explicitly with the transaction. Any System.Transactions resource manager will detect the ambient transaction created by the scope and automatically enlist.
  • Overall, it is a simple and intuitive programming model even for the more complex scenarios that involve transaction flow and nesting.
Incognito