Clone() public method

public Clone ( ) : System.Transactions.Transaction
return System.Transactions.Transaction
        public TransactionContext(WorkflowServiceInstance durableInstance, Transaction currentTransaction)
        {
            Fx.Assert(durableInstance != null, "Null DurableInstance passed to TransactionContext.");
            Fx.Assert(currentTransaction != null, "Null Transaction passed to TransactionContext.");

            this.currentTransaction = currentTransaction.Clone();
            this.durableInstance = durableInstance;
            this.currentTransaction.EnlistVolatile(this, EnlistmentOptions.EnlistDuringPrepareRequired);
        }
Example #2
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="session">The session to enlist with the transaction.</param>
 /// <param name="transaction">The transaction into which the context will be enlisted.</param>
 /// <param name="systemTransactionCompletionLockTimeout">See <see cref="Cfg.Environment.SystemTransactionCompletionLockTimeout"/>.</param>
 /// <param name="useConnectionOnSystemTransactionPrepare">See <see cref="Cfg.Environment.UseConnectionOnSystemTransactionPrepare"/>.</param>
 public SystemTransactionContext(
     ISessionImplementor session,
     System.Transactions.Transaction transaction,
     int systemTransactionCompletionLockTimeout,
     bool useConnectionOnSystemTransactionPrepare)
 {
     _session             = session ?? throw new ArgumentNullException(nameof(session));
     _originalTransaction = transaction ?? throw new ArgumentNullException(nameof(transaction));
     EnlistedTransaction  = transaction.Clone();
     _systemTransactionCompletionLockTimeout  = systemTransactionCompletionLockTimeout;
     _useConnectionOnSystemTransactionPrepare = useConnectionOnSystemTransactionPrepare;
 }
        internal InstancePersistenceContext(InstanceHandle handle, Transaction transaction)
            : this(handle)
        {
            Fx.Assert(transaction != null, "Null Transaction passed to InstancePersistenceContext.");

            // Let's take our own clone of the transaction. We need to do this because we might need to
            // create a TransactionScope using the transaction and in cases where we are dealing with a
            // transaction that is flowed into the workflow on a message, the DependentTransaction that the
            // dispatcher creates and sets to Transaction.Current may already be Completed by the time a
            // Save operation is done. And since TransactionScope creates a DependentTransaction, it won't
            // be able to.
            // We don't create another DependentClone because we are going to do a EnlistVolatile on the
            // transaction ourselves.
            this.transaction = transaction.Clone();
            IsHostTransaction = true;
            this.eventTraceActivity = handle.EventTraceActivity;
        }
Example #4
0
 private TransactedRegistryKey(SafeRegistryHandle hkey, bool writable, bool systemkey, Transaction transaction, SafeTransactionHandle txHandle)
 {
     this.hkey = hkey;
     this.keyName = "";
     if (systemkey)
     {
         this.state |= 2;
     }
     if (writable)
     {
         this.state |= 4;
     }
     if (null != transaction)
     {
         this.myTransaction = transaction.Clone();
         this.myTransactionHandle = txHandle;
     }
     else
     {
         this.myTransaction = null;
         this.myTransactionHandle = null;
     }
 }
Example #5
0
 public DistributedTransactionContext(ISessionImplementor sessionImplementor, System.Transactions.Transaction transaction)
 {
     this.sessionImplementor = sessionImplementor;
     AmbientTransation       = transaction.Clone();
     IsInActiveTransaction   = true;
 }
 public TransactionContext(WorkflowServiceInstance durableInstance, Transaction currentTransaction)
 {
     this.currentTransaction = currentTransaction.Clone();
     this.durableInstance = durableInstance;
     this.currentTransaction.EnlistVolatile(this, EnlistmentOptions.EnlistDuringPrepareRequired);
 }