internal void Complete(Exception error) { if (!object.ReferenceEquals(this.Current, null)) { TransactedBatchContext batchContext = this.rpc.TransactedBatchContext; if (null != batchContext) { if (null == error) { batchContext.Complete(); } else { batchContext.ForceRollback(); } batchContext.InDispatch = false; } else { if (this.transactionSetComplete) { // Commit the transaction when TransactionSetComplete() is called and // even when an exception(non transactional) happens after this call. rpc.InstanceContext.Transaction.CompletePendingTransaction(this.Current, null); if (DiagnosticUtility.ShouldTraceInformation) { TraceUtility.TraceEvent(TraceEventType.Information, TraceCode.TxCompletionStatusCompletedForSetComplete, SR.GetString(SR.TraceCodeTxCompletionStatusCompletedForSetComplete, this.Current.TransactionInformation.LocalIdentifier, this.rpc.Operation.Name) ); } } else if (this.IsCompleted || (error != null)) { rpc.InstanceContext.Transaction.CompletePendingTransaction(this.Current, error); } } if (this.rpc.Operation.IsInsideTransactedReceiveScope) { //We are done with the message processing associated with this TransactionRpcFacet so a commit that may have //been started by a TransactedReceiveScope can move forward. this.CompleteDependentClone(); } this.Current = null; } }
internal void Complete(Exception error) { if (!object.ReferenceEquals(this.Current, null)) { TransactedBatchContext transactedBatchContext = this.rpc.TransactedBatchContext; if (transactedBatchContext != null) { if (error == null) { transactedBatchContext.Complete(); } else { transactedBatchContext.ForceRollback(); } transactedBatchContext.InDispatch = false; } else if (this.transactionSetComplete) { this.rpc.InstanceContext.Transaction.CompletePendingTransaction(this.Current, null); if (DiagnosticUtility.ShouldTraceInformation) { TraceUtility.TraceEvent(TraceEventType.Information, 0xe0007, System.ServiceModel.SR.GetString("TraceCodeTxCompletionStatusCompletedForSetComplete", new object[] { this.Current.TransactionInformation.LocalIdentifier, this.rpc.Operation.Name })); } } else if (this.IsCompleted || (error != null)) { this.rpc.InstanceContext.Transaction.CompletePendingTransaction(this.Current, error); } if (this.rpc.Operation.IsInsideTransactedReceiveScope) { this.CompleteDependentClone(); } this.Current = null; } }