本文整理汇总了C#中System.Transactions.Transaction.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.GetHashCode方法的具体用法?C# Transaction.GetHashCode怎么用?C# Transaction.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Transactions.Transaction
的用法示例。
在下文中一共展示了Transaction.GetHashCode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveDriverInTransaction
public static void RemoveDriverInTransaction(Transaction transaction)
{
lock (driversInUse.SyncRoot)
{
driversInUse.Remove(transaction.GetHashCode());
}
}
示例2: GetDriverInTransaction
public static Driver GetDriverInTransaction(Transaction transaction)
{
lock (driversInUse.SyncRoot)
{
return (Driver) driversInUse[transaction.GetHashCode()];
}
}
示例3: AddToConnectionInfoTable
private void AddToConnectionInfoTable(Transaction transaction, SharedConnectionInfo connectionInfo)
{
lock (this.tableSyncObject)
{
this.transactionConnectionTable.Add(transaction, connectionInfo);
WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, string.Concat(new object[] { "AddToConnectionInfoTable ", transaction.GetHashCode(), " in table of count ", this.transactionConnectionTable.Count }));
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:SharedConnectionWorkflowCommitWorkBatchService.cs
示例4: AddToConnectionInfoTable
private void AddToConnectionInfoTable(Transaction transaction, SharedConnectionInfo connectionInfo)
{
lock (this.tableSyncObject)
{
this.transactionConnectionTable.Add(transaction, connectionInfo);
WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, "AddToConnectionInfoTable " + transaction.GetHashCode() +
" in table of count " + this.transactionConnectionTable.Count);
}
}
示例5: RemoveConnectionFromInfoTable
private void RemoveConnectionFromInfoTable(Transaction transaction)
{
lock (this.tableSyncObject)
{
SharedConnectionInfo connectionInfo;
WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, "TransactionCompleted " + transaction.GetHashCode());
if (transactionConnectionTable.TryGetValue(transaction, out connectionInfo))
{
connectionInfo.Dispose();
this.transactionConnectionTable.Remove(transaction);
}
else
{
WorkflowTrace.Host.TraceEvent(TraceEventType.Information, 0, "TransactionCompleted " + transaction.GetHashCode() +
" not found in table of count " + this.transactionConnectionTable.Count);
}
}
}
示例6: EnlistNonNull
private void EnlistNonNull(Transaction tx)
{
if (Bid.AdvancedOn)
{
Bid.Trace("<sc.SqlInternalConnection.EnlistNonNull|ADV> %d#, transaction %d#.\n", base.ObjectID, tx.GetHashCode());
}
bool flag = false;
if (this.IsYukonOrNewer)
{
if (Bid.AdvancedOn)
{
Bid.Trace("<sc.SqlInternalConnection.EnlistNonNull|ADV> %d#, attempting to delegate\n", base.ObjectID);
}
SqlDelegatedTransaction promotableSinglePhaseNotification = new SqlDelegatedTransaction(this, tx);
try
{
if (tx.EnlistPromotableSinglePhase(promotableSinglePhaseNotification))
{
flag = true;
this.DelegatedTransaction = promotableSinglePhaseNotification;
if (Bid.AdvancedOn)
{
long transactionId = 0L;
int objectID = 0;
if (this.CurrentTransaction != null)
{
transactionId = this.CurrentTransaction.TransactionId;
objectID = this.CurrentTransaction.ObjectID;
}
Bid.Trace("<sc.SqlInternalConnection.EnlistNonNull|ADV> %d#, delegated to transaction %d# with transactionId=0x%I64x\n", base.ObjectID, objectID, transactionId);
}
}
}
catch (SqlException exception)
{
if (exception.Class >= 20)
{
throw;
}
SqlInternalConnectionTds tds = this as SqlInternalConnectionTds;
if (tds != null)
{
TdsParser parser = tds.Parser;
if ((parser == null) || (parser.State != TdsParserState.OpenLoggedIn))
{
throw;
}
}
ADP.TraceExceptionWithoutRethrow(exception);
}
}
if (!flag)
{
if (Bid.AdvancedOn)
{
Bid.Trace("<sc.SqlInternalConnection.EnlistNonNull|ADV> %d#, delegation not possible, enlisting.\n", base.ObjectID);
}
byte[] transactionCookie = null;
if (this._whereAbouts == null)
{
byte[] dTCAddress = this.GetDTCAddress();
if (dTCAddress == null)
{
throw SQL.CannotGetDTCAddress();
}
this._whereAbouts = dTCAddress;
}
transactionCookie = GetTransactionCookie(tx, this._whereAbouts);
this.PropagateTransactionCookie(transactionCookie);
this._isEnlistedInTransaction = true;
if (Bid.AdvancedOn)
{
long num2 = 0L;
int num = 0;
if (this.CurrentTransaction != null)
{
num2 = this.CurrentTransaction.TransactionId;
num = this.CurrentTransaction.ObjectID;
}
Bid.Trace("<sc.SqlInternalConnection.EnlistNonNull|ADV> %d#, enlisted with transaction %d# with transactionId=0x%I64x\n", base.ObjectID, num, num2);
}
}
base.EnlistedTransaction = tx;
}
示例7: CreateVolatileEnlistment
TransactionException CreateVolatileEnlistment(Transaction transactionToEnlist)
{
TransactionException result = null;
PersistenceContextEnlistment enlistment = null;
int key = transactionToEnlist.GetHashCode();
lock (PersistenceContext.Enlistments)
{
try
{
if (!PersistenceContext.Enlistments.TryGetValue(key, out enlistment))
{
enlistment = new PersistenceContextEnlistment(this.PersistenceContext, transactionToEnlist);
transactionToEnlist.EnlistVolatile(enlistment, EnlistmentOptions.None);
// We don't save of the Enlistment object returned from EnlistVolatile. We don't need
// it here. When our PersistenceContextEnlistment object gets notified on Prepare,
// Commit, Rollback, or InDoubt, it is provided with the Enlistment object.
PersistenceContext.Enlistments.Add(key, enlistment);
}
else
{
enlistment.AddToEnlistment(this.PersistenceContext);
}
}
catch (TransactionException txException)
{
result = txException;
// We own the lock but failed to create enlistment. Manually wake up the next waiter.
// We only handle TransactionException, in case of other exception that failed to create enlistment,
// It will fallback to Timeout. This is safe to avoid multiple waiters owning same lock.
this.PersistenceContext.ScheduleNextTransactionWaiter();
}
}
return result;
}