Provides an "ambient" context for stashing away an instance that implements the current ITransactionContext. The ambient transaction context is automatically preserved even though threads are changed etc.
Exemplo n.º 1
0
 /// <summary>
 /// Disposes the transaction context and removes it from <see cref="AmbientTransactionContext.Current"/> again
 /// </summary>
 public void Dispose()
 {
     try
     {
         _transactionContext?.Dispose();
     }
     finally
     {
         AmbientTransactionContext.SetCurrent(null);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new transaction context and mounts it on <see cref="AmbientTransactionContext.Current"/>, making it available for Rebus
 /// to pick up
 /// </summary>
 public DefaultTransactionContextScope()
 {
     AmbientTransactionContext.SetCurrent(_transactionContext);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new transaction context and mounts it on <see cref="AmbientTransactionContext.Current"/>, making it available for Rebus
 /// to pick up. The context can also be retrieved simply via <see cref="TransactionContext"/>
 /// </summary>
 public RebusTransactionScope()
 {
     AmbientTransactionContext.SetCurrent(_transactionContext);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new transaction context and mounts it on <see cref="AmbientTransactionContext.Current"/>, making it available for Rebus
 /// to pick up. The context can also be retrieved simply via <see cref="TransactionContext"/>
 /// </summary>
 public RebusTransactionScope()
 {
     _previousTransactionContext = AmbientTransactionContext.Current;
     AmbientTransactionContext.SetCurrent(_transactionContext);
 }