本文整理汇总了C#中System.Transactions.SinglePhaseEnlistment类的典型用法代码示例。如果您正苦于以下问题:C# SinglePhaseEnlistment类的具体用法?C# SinglePhaseEnlistment怎么用?C# SinglePhaseEnlistment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SinglePhaseEnlistment类属于System.Transactions命名空间,在下文中一共展示了SinglePhaseEnlistment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SinglePhaseCommit
public void SinglePhaseCommit(SinglePhaseEnlistment en)
{
if (en == null)
{
throw new ArgumentNullException("en");
}
try
{
this.handle.WaitOne();
}
catch (ObjectDisposedException)
{
}
lock (this.syncRoot)
{
try
{
this.transaction.Commit();
en.Committed();
}
catch (Exception exception)
{
en.Aborted(exception);
}
finally
{
if ((this.connection != null) && (this.connection.State != ConnectionState.Closed))
{
this.connection.Close();
this.connection = null;
}
}
}
}
示例2: Rollback
public void Rollback(SinglePhaseEnlistment en)
{
if (en == null)
{
throw new ArgumentNullException("en");
}
try
{
this.handle.WaitOne();
}
catch (ObjectDisposedException)
{
}
lock (this.syncRoot)
{
if (this.transaction != null)
{
this.transaction.Dispose();
}
if ((this.connection != null) && (this.connection.State != ConnectionState.Closed))
{
this.connection.Close();
this.connection = null;
}
en.Aborted();
}
}
示例3: SinglePhaseCommit
/// <summary>
/// Notifies an enlisted object that the transaction is being committed.
/// </summary>
/// <param name="singlePhaseEnlistment">A <see cref="T:System.Transactions.SinglePhaseEnlistment"/> interface used to send a response to the transaction manager.</param>
public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
{
onTxComplete();
session.Commit(GetLocalOrDistributedTransactionId(transaction));
singlePhaseEnlistment.Committed();
}
示例4:
void IPromotableSinglePhaseNotification.SinglePhaseCommit( SinglePhaseEnlistment singlePhaseEnlistment ) {
this.simpleTransaction.Commit();
singlePhaseEnlistment.Committed();
DriverTransactionManager.RemoveDriverInTransaction( this.baseTransaction );
this.connection.driver.CurrentTransaction = null;
if( this.connection.State == ConnectionState.Closed ) {
this.connection.CloseFully();
}
}
示例5: SinglePhaseCommit
public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
{
simpleTransaction.Commit();
singlePhaseEnlistment.Committed();
DriverTransactionManager.RemoveDriverInTransaction(baseTransaction);
if (connection.State == ConnectionState.Closed)
connection.CloseFully();
}
示例6:
void IPromotableSinglePhaseNotification.Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
simpleTransaction.Rollback();
singlePhaseEnlistment.Aborted();
DriverTransactionManager.RemoveDriverInTransaction(baseTransaction);
connection.driver.CurrentTransaction = null;
if (connection.State == ConnectionState.Closed)
connection.CloseFully();
}
示例7: SinglePhaseCommit
public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
{
try
{
Neo4jTransaction.DoCommit(_transactionExecutionEnvironment);
singlePhaseEnlistment.Committed();
}
finally
{
singlePhaseEnlistment.Aborted();
}
}
示例8: SinglePhaseCommit
public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
{
try
{
Commit();
singlePhaseEnlistment.Done();
}
catch (Exception)
{
//on a callback thread, can't throw
}
}
示例9: SinglePhaseCommit
public void SinglePhaseCommit(SinglePhaseEnlistment en)
{
if (en == null)
throw new ArgumentNullException("en");
//
// Wait until IPendingWork members have completed (WinOE bugs 17580 and 13395)
try
{
handle.WaitOne();
}
catch (ObjectDisposedException)
{
// If an ObjectDisposedException is thrown because
// the WaitHandle has already closed, nothing to worry
// about. Move on.
}
lock (syncRoot)
{
try
{
this.transaction.Commit();
en.Committed();
}
catch (Exception e)
{
en.Aborted(e);
}
finally
{
if ((null != connection) && (ConnectionState.Closed != connection.State))
{
connection.Close();
connection = null;
}
}
}
}
示例10: Rollback
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
// prevent commands in main thread to run concurrently
Driver driver = connection.driver;
lock (driver)
{
rollbackThreadId = Thread.CurrentThread.ManagedThreadId;
while (connection.Reader != null)
{
// wait for reader to finish. Maybe we should not wait
// forever and cancel it after some time?
System.Threading.Thread.Sleep(100);
}
simpleTransaction.Rollback();
singlePhaseEnlistment.Aborted();
DriverTransactionManager.RemoveDriverInTransaction(baseTransaction);
if (connection.State == ConnectionState.Closed)
connection.CloseFully();
rollbackThreadId = 0;
}
}
示例11: Rollback
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment) {}
示例12: SinglePhaseCommit
public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment) {}
示例13: SinglePhaseCommit
public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
{
_log.Debug("Single Phase Commit");
if (_npgsqlTx != null)
{
_npgsqlTx.Commit();
_npgsqlTx.Dispose();
_npgsqlTx = null;
singlePhaseEnlistment.Committed();
_connection.PromotableLocalTransactionEnded();
}
else if (_callbacks != null)
{
if (_rm != null)
{
_rm.CommitWork(_callbacks.GetName());
singlePhaseEnlistment.Committed();
}
else
{
_callbacks.CommitTransaction();
singlePhaseEnlistment.Committed();
}
_callbacks = null;
}
_inTransaction = false;
}
示例14: 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();
}
示例15: Rollback
public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
{
singlePhaseEnlistment.Done();
}