tags:

views:

56

answers:

2
+1  Q: 

Wcf transaction

Is there a way to know in a wcf operation that a transaction has committed?

Ok, second attempt into being more specific.

I got a WCF service with an Operation with Transaction flow allow.

Now when a client call my wcf service it can have a transaction. But my service is also interested in the fact that the transaction on the client has succeeded. Because on my wcf service level, if everything went well. It has other things to do, but only if all transactions has been committed....

Is there like an event I can subscribe to or something?

+1  A: 

It depends on the service itself and how you are handling transactions. If you are engaging in transactions in WCF through WS-Transaction then if the call to the client succeeds without exception, you can assume the transaction took place.

However, if this is in the context of another transaction, then you can't be sure if the transaction went through until the containing transaction is completed.

Even if you are using the TransactionScope class, if you have the service enabled to use transactions, you still have to take into account the encompassing transaction (if there is one).

You will have to provide more information about where the transaction is in relation to the call in order for a more complete answer.

casperOne
Is there like an event I can subscribe to get notified the transaction has committed?
pdiddy
A: 

Try using the operation behavior attribute above, in your operation that allows TransactionFlow:

[OperationBehavior(TransactionScopeRequired=true)]

If a transaction flows from the client, then the service will use it.

Erup