I just read a fantastic article about WCF transactions and flow. Pretty much only left me with one unanswered question:
I have a single project with two service methods defined:
ServiceA.svc
[OperationBehavior(TransactionScopeRequired = true)]
OperationA()
ServiceB.svc
[OperationBehavior(TransactionScopeRequired = true)]
OperationB()
OperationA()
needs to call OperationB()
.
I could quite easily just say new ServiceB().OperationB(...)
from within ServiceA
(remember i said they are in the same web project running on the same server.
At first I thought this is what I would do, but I'm not sure if transactions will all get screwed up or not - especially if the transaction contracts differed between the two operations. Obviously if I'm accessing Transaction.Current
from within OperationB
then it will exist, but if the two operations had diffrent contracts (as described in the referenced article) the rules would not be followed.
What's the correct way for ServiceA.OperationA()
to call ServiceB.OperationB()
?
(Curious also how to do this when one operation calls another in the same class, but thats probably an easier thing to google for)