コード例 #1
0
 /// <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);
 }
コード例 #2
0
        internal void Run()
        {
            Tuple <SendOrPostCallback, object, ITransactionContext> tuple;

            while (callbacks.TryDequeue(out tuple))
            {
                TransactionContext.Set(tuple.Item3);
                tuple.Item1(tuple.Item2);
                TransactionContext.Clear();
            }
        }
コード例 #3
0
ファイル: NoTransaction.cs プロジェクト: rasmuskl/Rebus
 /// <summary>
 /// Constructs the context and sets itself as current in <see cref="TransactionContext"/>.
 /// </summary>
 public NoTransaction()
 {
     TransactionContext.Set(this);
 }
コード例 #4
0
ファイル: TxBomkarl.cs プロジェクト: rasmuskl/Rebus
 /// <summary>
 /// Constructs the context and sets itself as current in <see cref="TransactionContext"/>.
 /// </summary>
 public TxBomkarl()
 {
     TransactionContext.Set(this);
 }
コード例 #5
0
 /// <summary>
 /// Constructs the context and sets itself as current in <see cref="TransactionContext"/>.
 /// </summary>
 public TxBomkarl()
 {
     TransactionContext.Set(this);
     threadName = Thread.CurrentThread.Name;
 }