WCF/WF - Why do we need flowed TransactionScope?

Asked By Perry on 09-May-10 12:52 PM


I know that we can create Transactionscope instance and withing "using" statement, we can place all the operations that needs to be completed with ACID properties When we specify "TransactionFlow.Allowed", the current transaction scope will be executed in flowed transaction scope. Could you tell me why do we need to have this flowed transaction mechanism? What are the situations where we have to enable it?


Peter Bromberg replied to Perry on 09-May-10 01:14 PM
Transaction Flow is a WS* specification and allows for a greater degree of granularity across different boundaries.
See here for more info:
Perry replied to Peter Bromberg on 09-May-10 01:20 PM
Thanks Peter. I have already gone through that msdn page and I know how to use TransactionFlow and what are the different options supported but I couldn't figured out why do we really need it? It would be great if you could you provide some real time situation where we have to use TrasactionFlow.

Peter Bromberg replied to Perry on 09-May-10 01:46 PM
They have a sample right there on the page that refers to the use of TransactionFlow and explains how it works. It illustrates exactly why and under what conditions you might need it and how the various attributes work.  Did you not read  this? What exactly about their explanation is it that you don't understand?
Perry replied to Peter Bromberg on 10-May-10 04:08 PM
Peter, I do understand that example but it is the usage rather than a real time example. Sorry I wasn't clear. I got the real time example. Putting it here.

Flowing transactions is used when an operation in service A needs to rollback if an operation in service B executed in the same scope fails.


We have 3 services: DebitService, CreditService and AccountManager. We implement an operation to transfer money from account 123 to account 456. In the implementation of Transfer in AccountManager, DebitService is called to take a sum of money from account 123 and CreditService is called to add that same sum of money to account 456. These operation are called in a transaction scope so that if the call to DebitService fails, then the sum of money taken from account 123 by DebitService is rollback as if nothing happened.