/// <summary> /// Constructs the context, enlists it in the ambient transaction, and sets itself as the current context in <see cref="TransactionContext"/>. /// </summary> public AmbientTransactionContext() { if (Transaction.Current == null) { throw new InvalidOperationException("There's currently no ambient transaction associated with this thread." + " You can only instantiate this class within a TransactionScope."); } Transaction.Current.EnlistVolatile(this, EnlistmentOptions.None); TransactionContext.Set(this); }
internal void Run() { Tuple <SendOrPostCallback, object, ITransactionContext> tuple; while (callbacks.TryDequeue(out tuple)) { TransactionContext.Set(tuple.Item3); tuple.Item1(tuple.Item2); TransactionContext.Clear(); } }
/// <summary> /// Constructs the context and sets itself as current in <see cref="TransactionContext"/>. /// </summary> public NoTransaction() { TransactionContext.Set(this); }
/// <summary> /// Constructs the context and sets itself as current in <see cref="TransactionContext"/>. /// </summary> public TxBomkarl() { TransactionContext.Set(this); }
/// <summary> /// Constructs the context and sets itself as current in <see cref="TransactionContext"/>. /// </summary> public TxBomkarl() { TransactionContext.Set(this); threadName = Thread.CurrentThread.Name; }