Пример #1
0
 static void TransactionCommitCallback(IAsyncResult result)
 {
     System.Transactions.CommittableTransaction committableTransaction = result.AsyncState as System.Transactions.CommittableTransaction;
     Fx.Assert(committableTransaction != null, "TransactedReceiveScope - In the static TransactionCommitCallback, the committable transaction was null");
     try
     {
         committableTransaction.EndCommit(result);
     }
     catch (System.Transactions.TransactionException ex)
     {
         //At this point, the activity has completed. Since the runtime is enlisted in the transaction, it knows that the transaction aborted.
         //The runtime will do the right thing based on the AbortInstanceOnTransactionFailure flag. We simply trace out that the call to EndCommit failed from this static callback
         if (TD.TransactedReceiveScopeEndCommitFailedIsEnabled())
         {
             TD.TransactedReceiveScopeEndCommitFailed(committableTransaction.TransactionInformation.LocalIdentifier, ex.Message);
         }
     }
 }