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


C# Transaction.Equals方法代码示例

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


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

示例1: PushServiceDomain

        private void PushServiceDomain( Transaction newCurrent )
        {
            // If we are not changing the transaction for the current ServiceDomain then
            // don't call CoEnterServiceDomain
            if ((newCurrent != null && newCurrent.Equals( SysES.ContextUtil.SystemTransaction )) ||
                (newCurrent == null && SysES.ContextUtil.SystemTransaction == null ))
            {
                return;
            }

            SysES.ServiceConfig serviceConfig = new SysES.ServiceConfig();

            try
            {
                // If a transaction is specified place it in BYOT.  Otherwise the
                // default transaction option for ServiceConfig is disabled.  So 
                // if this is a not supported scope it will be cleared.
                if ( newCurrent != null )
                {
                    // To work around an SWC bug in Com+ we need to create 2
                    // service domains.

                    // Com+ will by default try to inherit synchronization from
                    // an existing context.  Turn that off.
                    serviceConfig.Synchronization = SysES.SynchronizationOption.RequiresNew;
                    SysES.ServiceDomain.Enter( serviceConfig );
                    this.createdDoubleServiceDomain = true;

                    serviceConfig.Synchronization = SysES.SynchronizationOption.Required;
                    serviceConfig.BringYourOwnSystemTransaction = newCurrent;
                }
                SysES.ServiceDomain.Enter( serviceConfig );
                this.createdServiceDomain = true;
            }
            catch ( COMException e )
            {
                if ( System.Transactions.Oletx.NativeMethods.XACT_E_NOTRANSACTION == e.ErrorCode )
                {
                    throw TransactionException.Create(SR.GetString(SR.TraceSourceBase),
                        SR.GetString(SR.TransactionAlreadyOver),
                        e,
                        newCurrent == null ? Guid.Empty : newCurrent.DistributedTxId);
                }

                throw TransactionException.Create(SR.GetString(SR.TraceSourceBase), e.Message, e, newCurrent == null ? Guid.Empty : newCurrent.DistributedTxId);
            }
            finally
            {
                if ( !this.createdServiceDomain )
                {
                    // If we weren't successful in creating both service domains then
                    // make sure to exit one of them.
                    if ( this.createdDoubleServiceDomain )
                    {
                        SysES.ServiceDomain.Leave();
                    }
                }
            }
                
        }
开发者ID:mind0n,项目名称:hive,代码行数:60,代码来源:TransactionScope.cs

示例2: DetachTransaction

 internal void DetachTransaction(Transaction transaction, bool isExplicitlyReleasing)
 {
     Bid.Trace("<prov.DbConnectionInternal.DetachTransaction|RES|CPOOL> %d#, Transaction Completed. (pooledCount=%d)\n", this.ObjectID, this._pooledCount);
     lock (this)
     {
         DbConnection owner = (DbConnection) this.Owner;
         if ((isExplicitlyReleasing || this.UnbindOnTransactionCompletion) || (owner == null))
         {
             Transaction transaction2 = this._enlistedTransaction;
             if ((transaction2 != null) && transaction.Equals(transaction2))
             {
                 this.EnlistedTransaction = null;
                 if (this.IsTxRootWaitingForTxEnd)
                 {
                     this.DelegatedTransactionEnded();
                 }
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:DbConnectionInternal.cs

示例3: RemoveReference

 internal void RemoveReference(Transaction tx)
 {
     lock (this.mutex)
     {
         if (tx.Equals(this.current))
         {
             if (this.waiting != null)
             {
                 bool flag;
                 this.current = this.waiting;
                 this.waiting = null;
                 if (this.instanceContext.Behavior.ReleaseServiceInstanceOnTransactionComplete)
                 {
                     this.instanceContext.ReleaseServiceInstance();
                     if (DiagnosticUtility.ShouldTraceInformation)
                     {
                         TraceUtility.TraceEvent(TraceEventType.Information, 0xe000c, System.ServiceModel.SR.GetString("TraceCodeTxReleaseServiceInstanceOnCompletion", new object[] { tx.TransactionInformation.LocalIdentifier }));
                     }
                 }
                 this.paused.Resume(out flag);
                 if (!flag)
                 {
                 }
             }
             else
             {
                 this.shouldReleaseInstance = true;
                 this.current = null;
             }
         }
         if ((this.pending != null) && this.pending.ContainsKey(tx))
         {
             this.pending.Remove(tx);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:36,代码来源:TransactionInstanceContextFacet.cs

示例4: RemoveReference

        internal void RemoveReference(Transaction tx)
        {
            lock (this.mutex)
            {
                if (tx.Equals(this.current))
                {
                    if (this.waiting != null)
                    {
                        this.current = waiting;
                        this.waiting = null;

                        if (instanceContext.Behavior.ReleaseServiceInstanceOnTransactionComplete)
                        {
                            instanceContext.ReleaseServiceInstance();
                            if (DiagnosticUtility.ShouldTraceInformation)
                            {
                                TraceUtility.TraceEvent(TraceEventType.Information,
                                    TraceCode.TxReleaseServiceInstanceOnCompletion,
                                    SR.GetString(SR.TraceCodeTxReleaseServiceInstanceOnCompletion,
                                    tx.TransactionInformation.LocalIdentifier)
                                    );
                            }
                        }

                        bool alreadyResumedNoLock;
                        this.paused.Resume(out alreadyResumedNoLock);
                        if (alreadyResumedNoLock)
                        {
                            Fx.Assert("TransactionBehavior resumed more than once for same call.");
                        }

                    }
                    else
                    {
                        this.shouldReleaseInstance = true;
                        this.current = null;
                    }

                }

                if (this.pending != null)
                {
                    if (this.pending.ContainsKey(tx))
                    {
                        this.pending.Remove(tx);
                    }
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:49,代码来源:TransactionBehavior.cs

示例5: EnlistTransaction

 public override void EnlistTransaction(Transaction transaction)
 {
     this.ValidateConnectionForExecute(null);
     if (this.HasLocalTransaction)
     {
         throw ADP.LocalTransactionPresent();
     }
     if ((null == transaction) || !transaction.Equals(base.EnlistedTransaction))
     {
         SNIHandle target = null;
         RuntimeHelpers.PrepareConstrainedRegions();
         try
         {
             target = GetBestEffortCleanupTarget(this.Connection);
             this.Enlist(transaction);
         }
         catch (OutOfMemoryException exception3)
         {
             this.Connection.Abort(exception3);
             throw;
         }
         catch (StackOverflowException exception2)
         {
             this.Connection.Abort(exception2);
             throw;
         }
         catch (ThreadAbortException exception)
         {
             this.Connection.Abort(exception);
             BestEffortCleanup(target);
             throw;
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:SqlInternalConnection.cs

示例6: Enlist

 protected void Enlist(Transaction tx)
 {
     if (null == tx)
     {
         if (this.IsEnlistedInTransaction)
         {
             this.EnlistNull();
         }
         else
         {
             Transaction enlistedTransaction = base.EnlistedTransaction;
             if ((enlistedTransaction != null) && (enlistedTransaction.TransactionInformation.Status != TransactionStatus.Active))
             {
                 this.EnlistNull();
             }
         }
     }
     else if (!tx.Equals(base.EnlistedTransaction))
     {
         this.EnlistNonNull(tx);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:SqlInternalConnection.cs

示例7: PushServiceDomain

 private void PushServiceDomain(Transaction newCurrent)
 {
     if (((newCurrent == null) || !newCurrent.Equals(ContextUtil.SystemTransaction)) && ((newCurrent != null) || (ContextUtil.SystemTransaction != null)))
     {
         ServiceConfig cfg = new ServiceConfig();
         try
         {
             if (newCurrent != null)
             {
                 cfg.Synchronization = SynchronizationOption.RequiresNew;
                 ServiceDomain.Enter(cfg);
                 this.createdDoubleServiceDomain = true;
                 cfg.Synchronization = SynchronizationOption.Required;
                 cfg.BringYourOwnSystemTransaction = newCurrent;
             }
             ServiceDomain.Enter(cfg);
             this.createdServiceDomain = true;
         }
         catch (COMException exception)
         {
             if (System.Transactions.Oletx.NativeMethods.XACT_E_NOTRANSACTION == exception.ErrorCode)
             {
                 throw TransactionException.Create(System.Transactions.SR.GetString("TraceSourceBase"), System.Transactions.SR.GetString("TransactionAlreadyOver"), exception);
             }
             throw TransactionException.Create(System.Transactions.SR.GetString("TraceSourceBase"), exception.Message, exception);
         }
         finally
         {
             if (!this.createdServiceDomain && this.createdDoubleServiceDomain)
             {
                 ServiceDomain.Leave();
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:TransactionScope.cs


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