本文整理汇总了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();
}
}
}
}
示例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();
}
}
}
}
}
示例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);
}
}
}
}
示例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;
}
}
}
示例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);
}
}
示例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();
}
}
}
}