本文整理匯總了C#中System.Transactions.SinglePhaseEnlistment.InDoubt方法的典型用法代碼示例。如果您正苦於以下問題:C# SinglePhaseEnlistment.InDoubt方法的具體用法?C# SinglePhaseEnlistment.InDoubt怎麽用?C# SinglePhaseEnlistment.InDoubt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Transactions.SinglePhaseEnlistment
的用法示例。
在下文中一共展示了SinglePhaseEnlistment.InDoubt方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Rollback
/// <summary>
/// Rollbacks the specified single phase enlistment.
/// </summary>
/// <param name="singlePhaseEnlistment">The single phase enlistment.</param>
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
onTxComplete();
try
{
session.Rollback(PromotableRavenClientEnlistment.GetLocalOrDistributedTransactionId(transaction));
using (var machineStoreForApplication = IsolatedStorageFile.GetMachineStoreForDomain())
{
machineStoreForApplication.DeleteFile(TransactionRecoveryInformationFileName);
}
}
catch (Exception e)
{
logger.ErrorException("Could not rollback distributed transaction", e);
singlePhaseEnlistment.InDoubt(e);
return;
}
singlePhaseEnlistment.Aborted();
}
示例2: Rollback
/// <summary>
/// Rollbacks the specified single phase enlistment.
/// </summary>
/// <param name="singlePhaseEnlistment">The single phase enlistment.</param>
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
onTxComplete();
try
{
session.Rollback(transaction.LocalIdentifier);
DeleteFile();
}
catch (Exception e)
{
logger.ErrorException("Could not rollback distributed transaction", e);
singlePhaseEnlistment.InDoubt(e);
return;
}
singlePhaseEnlistment.Aborted();
ctx.Dispose();
}
示例3: Rollback
/// <summary>
/// Rollbacks the specified single phase enlistment.
/// </summary>
/// <param name="singlePhaseEnlistment">The single phase enlistment.</param>
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
onTxComplete();
try
{
session.Rollback(PromotableRavenClientEnlistment.GetLocalOrDistributedTransactionId(transaction));
DeleteFile();
}
catch (Exception e)
{
logger.ErrorException("Could not rollback distributed transaction", e);
singlePhaseEnlistment.InDoubt(e);
return;
}
singlePhaseEnlistment.Aborted();
}
示例4: SinglePhaseCommit
public void SinglePhaseCommit(SinglePhaseEnlistment enlistment)
{
SqlInternalConnection validConnection = this.GetValidConnection();
SqlConnection connection = validConnection.Connection;
Bid.Trace("<sc.SqlDelegatedTransaction.SinglePhaseCommit|RES|CPOOL> %d#, Connection %d#, committing transaction.\n", this.ObjectID, validConnection.ObjectID);
RuntimeHelpers.PrepareConstrainedRegions();
try
{
if (validConnection.IsConnectionDoomed)
{
lock (validConnection)
{
this._active = false;
this._connection = null;
}
enlistment.Aborted(SQL.ConnectionDoomed());
}
else
{
Exception exception;
lock (validConnection)
{
try
{
this.ValidateActiveOnConnection(validConnection);
this._active = false;
this._connection = null;
validConnection.ExecuteTransaction(SqlInternalConnection.TransactionRequest.Commit, null, System.Data.IsolationLevel.Unspecified, this._internalTransaction, true);
exception = null;
}
catch (SqlException exception3)
{
exception = exception3;
ADP.TraceExceptionWithoutRethrow(exception3);
validConnection.DoomThisConnection();
}
catch (InvalidOperationException exception2)
{
exception = exception2;
ADP.TraceExceptionWithoutRethrow(exception2);
validConnection.DoomThisConnection();
}
}
if (exception != null)
{
if (this._internalTransaction.IsCommitted)
{
enlistment.Committed();
}
else if (this._internalTransaction.IsAborted)
{
enlistment.Aborted(exception);
}
else
{
enlistment.InDoubt(exception);
}
}
validConnection.CleanupConnectionOnTransactionCompletion(this._atomicTransaction);
if (exception == null)
{
enlistment.Committed();
}
}
}
catch (OutOfMemoryException exception6)
{
connection.Abort(exception6);
throw;
}
catch (StackOverflowException exception5)
{
connection.Abort(exception5);
throw;
}
catch (ThreadAbortException exception4)
{
connection.Abort(exception4);
throw;
}
}