当前位置: 首页>>代码示例>>C#>>正文


C# Transaction.DependentClone方法代码示例

本文整理汇总了C#中System.Transactions.Transaction.DependentClone方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.DependentClone方法的具体用法?C# Transaction.DependentClone怎么用?C# Transaction.DependentClone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Transactions.Transaction的用法示例。


在下文中一共展示了Transaction.DependentClone方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TransactionWaitAsyncResult

        internal TransactionWaitAsyncResult(Transaction transaction, PersistenceContext persistenceContext, TimeSpan timeout, AsyncCallback callback, object state)
            : base(callback, state)
        {
            bool completeSelf = false;
            TransactionException exception = null;
            this.PersistenceContext = persistenceContext;
            this.thisLock = new object();

            if (null != transaction)
            {
                // We want an "blocking" dependent transaction because we want to ensure the transaction
                // does not commit successfully while we are still waiting in the queue for the PC transaction
                // lock.
                this.dependentTransaction = transaction.DependentClone(DependentCloneOption.BlockCommitUntilComplete);
            }
            else
            {
                this.dependentTransaction = null;
            }

            // Put a lock around this and Complete() in case the transaction we are queueing up behind
            // finishes and we end up calling Complete() before we actually finish constructing this
            // object by creating the DependentClone and setting up the IOThreadTimer.
            lock (ThisLock)
            {
                if (persistenceContext.QueueForTransactionLock(transaction, this))
                {
                    // If we were given a transaction in our constructor, we need to 
                    // create a volatile enlistment on it and complete the
                    // dependent clone that we created. This will allow the transaction to commit
                    // successfully when the time comes.
                    if (null != transaction)
                    {
                        // We are not going async, so we need to complete our dependent clone now.
                        this.dependentTransaction.Complete();

                        exception = this.CreateVolatileEnlistment(transaction);
                    }
                    completeSelf = true;
                }
                else
                {
                    // If the timeout value is not TimeSpan.MaxValue, start a timer.
                    if (timeout != TimeSpan.MaxValue)
                    {
                        this.timer = new IOThreadTimer(TimeoutCallbackAction, this, true);
                        this.timer.Set(timeout);
                    }
                }
            }

            // We didn't want to call Complete while holding the lock.
            if (completeSelf)
            {
                base.Complete(true, exception);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:57,代码来源:TransactionWaitAsyncResult.cs

示例2: SqlWorkflowInstanceStoreAsyncResult

 protected SqlWorkflowInstanceStoreAsyncResult(System.Runtime.DurableInstancing.InstancePersistenceContext context, System.Runtime.DurableInstancing.InstancePersistenceCommand command, SqlWorkflowInstanceStore store, SqlWorkflowInstanceStoreLock storeLock, Transaction currentTransaction, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
 {
     this.DependentTransaction = (currentTransaction != null) ? currentTransaction.DependentClone(DependentCloneOption.BlockCommitUntilComplete) : null;
     this.InstancePersistenceContext = context;
     this.InstancePersistenceCommand = command;
     this.Store = store;
     this.StoreLock = storeLock;
     this.TimeoutHelper = new System.Runtime.TimeoutHelper(timeout);
     base.OnCompleting = (Action<AsyncResult, Exception>) Delegate.Combine(base.OnCompleting, finallyCallback);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:SqlWorkflowInstanceStoreAsyncResult.cs

示例3: base

 // ExtendLockAsyncResult and RecoverInstanceLocksAsyncResult directly call this ctor
 protected SqlWorkflowInstanceStoreAsyncResult
     (
     InstancePersistenceContext context,
     InstancePersistenceCommand command,
     SqlWorkflowInstanceStore store,
     SqlWorkflowInstanceStoreLock storeLock,
     Transaction currentTransaction,
     TimeSpan timeout,
     int maximumRetries,
     AsyncCallback callback,
     object state
     ) :
     base(callback, state)
 {
     this.DependentTransaction = (currentTransaction != null) ? currentTransaction.DependentClone(DependentCloneOption.BlockCommitUntilComplete) : null;
     this.InstancePersistenceContext = context;
     this.InstancePersistenceCommand = command;
     this.Store = store;
     this.StoreLock = storeLock;
     this.TimeoutHelper = new TimeoutHelper(timeout);
     this.OnCompleting += SqlWorkflowInstanceStoreAsyncResult.finallyCallback;
     this.maximumRetries = maximumRetries;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:24,代码来源:SqlWorkflowInstanceStoreAsyncResult.cs

示例4: SetCurrent

        // SetCurrent
        //
        // Place the given value in current by whatever means necessary for interop mode.
        private void SetCurrent(Transaction newCurrent)
        {
            // Keep a dependent clone of current if we don't have one and we are not committable
            if (_dependentTransaction == null && _committableTransaction == null)
            {
                if (newCurrent != null)
                {
                    _dependentTransaction = newCurrent.DependentClone(DependentCloneOption.RollbackIfNotComplete);
                }
            }

            switch (_interopOption)
            {
                case EnterpriseServicesInteropOption.None:
                    _threadContextData.CurrentTransaction = newCurrent;
                    break;

                case EnterpriseServicesInteropOption.Automatic:
                    EnterpriseServices.VerifyEnterpriseServicesOk();
                    if (EnterpriseServices.UseServiceDomainForCurrent())
                    {
                        EnterpriseServices.PushServiceDomain(newCurrent);
                    }
                    else
                    {
                        _threadContextData.CurrentTransaction = newCurrent;
                    }
                    break;

                case EnterpriseServicesInteropOption.Full:
                    EnterpriseServices.VerifyEnterpriseServicesOk();
                    EnterpriseServices.PushServiceDomain(newCurrent);
                    break;
            }
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:38,代码来源:TransactionScope.cs

示例5: AddTransaction

 /// <summary>
 /// Indicate that sql is transaction if trans parameter is not null
 /// </summary>
 /// <param name="trans"></param>
 public void AddTransaction(Transaction trans)
 {
     if (trans != null)
         DependentTransaction = trans.DependentClone(DependentCloneOption.BlockCommitUntilComplete);
 }
开发者ID:WrongDog,项目名称:MyTest,代码行数:9,代码来源:ThreadSql.cs

示例6: SetCurrent

        private void SetCurrent(Transaction newCurrent)
        {
            if (((this.dependentTransaction == null) && (this.committableTransaction == null)) && (newCurrent != null))
            {
                this.dependentTransaction = newCurrent.DependentClone(DependentCloneOption.RollbackIfNotComplete);
            }
            switch (this.interopOption)
            {
                case EnterpriseServicesInteropOption.None:
                    this.threadContextData.CurrentTransaction = newCurrent;
                    return;

                case EnterpriseServicesInteropOption.Automatic:
                    Transaction.VerifyEnterpriseServicesOk();
                    if (!Transaction.UseServiceDomainForCurrent())
                    {
                        this.threadContextData.CurrentTransaction = newCurrent;
                        return;
                    }
                    this.PushServiceDomain(newCurrent);
                    return;

                case EnterpriseServicesInteropOption.Full:
                    Transaction.VerifyEnterpriseServicesOk();
                    this.PushServiceDomain(newCurrent);
                    return;
            }
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:TransactionScope.cs


注:本文中的System.Transactions.Transaction.DependentClone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。