internal override void EnterState(InternalTransaction tx) { if (tx.outcomeSource.isoLevel == IsolationLevel.Snapshot) { throw TransactionException.CreateInvalidOperationException(System.Transactions.SR.GetString("TraceSourceLtm"), System.Transactions.SR.GetString("CannotPromoteSnapshot"), null); } base.CommonEnterState(tx); OletxTransaction transaction = null; try { if (DiagnosticTrace.Verbose && (tx.durableEnlistment != null)) { EnlistmentNotificationCallTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), tx.durableEnlistment.EnlistmentTraceId, NotificationCall.Promote); } transaction = TransactionState._TransactionStatePSPEOperation.PSPEPromote(tx); } catch (TransactionPromotionException exception) { tx.innerException = exception; if (DiagnosticTrace.Verbose) { ExceptionConsumedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), exception); } } finally { if (transaction == null) { tx.State.ChangeStateAbortedDuringPromotion(tx); } } if (transaction != null) { tx.PromotedTransaction = transaction; Hashtable promotedTransactionTable = TransactionManager.PromotedTransactionTable; lock (promotedTransactionTable) { tx.finalizedObject = new FinalizedObject(tx, tx.PromotedTransaction.Identifier); WeakReference reference = new WeakReference(tx.outcomeSource, false); promotedTransactionTable[tx.PromotedTransaction.Identifier] = reference; } TransactionManager.FireDistributedTransactionStarted(tx.outcomeSource); if (DiagnosticTrace.Information) { TransactionPromotedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), tx.TransactionTraceId, transaction.TransactionTraceId); } this.PromoteEnlistmentsAndOutcome(tx); } }
internal override void EnterState(InternalTransaction tx) { if (tx.outcomeSource.isoLevel == IsolationLevel.Snapshot) { throw TransactionException.CreateInvalidOperationException(System.Transactions.SR.GetString("TraceSourceLtm"), System.Transactions.SR.GetString("CannotPromoteSnapshot"), null); } base.CommonEnterState(tx); OletxCommittableTransaction transaction = null; try { TimeSpan zero; if (tx.AbsoluteTimeout == 0x7fffffffffffffffL) { zero = TimeSpan.Zero; } else { zero = TransactionManager.TransactionTable.RecalcTimeout(tx); if (zero <= TimeSpan.Zero) { return; } } TransactionOptions properties = new TransactionOptions { IsolationLevel = tx.outcomeSource.isoLevel, Timeout = zero }; transaction = TransactionManager.DistributedTransactionManager.CreateTransaction(properties); transaction.savedLtmPromotedTransaction = tx.outcomeSource; if (DiagnosticTrace.Information) { TransactionPromotedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), tx.TransactionTraceId, transaction.TransactionTraceId); } } catch (TransactionException exception) { tx.innerException = exception; if (DiagnosticTrace.Verbose) { ExceptionConsumedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), exception); } return; } finally { if (transaction == null) { tx.State.ChangeStateAbortedDuringPromotion(tx); } } tx.PromotedTransaction = transaction; Hashtable promotedTransactionTable = TransactionManager.PromotedTransactionTable; lock (promotedTransactionTable) { tx.finalizedObject = new FinalizedObject(tx, transaction.Identifier); WeakReference reference = new WeakReference(tx.outcomeSource, false); promotedTransactionTable[transaction.Identifier] = reference; } TransactionManager.FireDistributedTransactionStarted(tx.outcomeSource); this.PromoteEnlistmentsAndOutcome(tx); }