本文整理汇总了C#中Spring.Transaction.Support.DefaultTransactionStatus类的典型用法代码示例。如果您正苦于以下问题:C# DefaultTransactionStatus类的具体用法?C# DefaultTransactionStatus怎么用?C# DefaultTransactionStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTransactionStatus类属于Spring.Transaction.Support命名空间,在下文中一共展示了DefaultTransactionStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSaveAndHoldValidSavepoint
public void CreateSaveAndHoldValidSavepoint()
{
ISavepointManager saveMgr = MockRepository.GenerateMock<ISavepointManager>();
DefaultTransactionStatus status = new DefaultTransactionStatus(saveMgr, true, false, false, true, new object());
status.CreateAndHoldSavepoint("savepoint");
Assert.IsTrue(status.HasSavepoint);
Assert.AreEqual("savepoint", status.Savepoint);
}
示例2: CreateSaveAndHoldValidSavepoint
public void CreateSaveAndHoldValidSavepoint()
{
MyMockTxnObjectSavepointMgr saveMgr = new MyMockTxnObjectSavepointMgr();
saveMgr.SetSavepointToReturn( "savepoint" );
DefaultTransactionStatus status = new DefaultTransactionStatus( saveMgr , true, false, false, true, new object());
status.CreateAndHoldSavepoint( "savepoint" );
Assert.IsTrue( status.HasSavepoint );
Assert.AreEqual( "savepoint", status.Savepoint );
}
示例3: RollbackHeldSavepointSuccess
public void RollbackHeldSavepointSuccess()
{
ISavepointManager saveMgr = MockRepository.GenerateMock<ISavepointManager>();
string savepoint = "savepoint";
DefaultTransactionStatus status = new DefaultTransactionStatus(saveMgr, true, false, false, true, new object());
status.CreateAndHoldSavepoint(savepoint);
Assert.IsTrue(status.HasSavepoint);
Assert.AreEqual(savepoint, status.Savepoint);
status.RollbackToHeldSavepoint();
saveMgr.AssertWasCalled(x => x.RollbackToSavepoint(savepoint));
}
示例4: RollbackHeldSavepointSuccess
public void RollbackHeldSavepointSuccess()
{
MyMockTxnObjectSavepointMgr saveMgr = new MyMockTxnObjectSavepointMgr();
string savepoint = "savepoint";
saveMgr.SetExpectedSavepoint( savepoint );
saveMgr.SetSavepointToReturn( savepoint );
DefaultTransactionStatus status = new DefaultTransactionStatus( saveMgr , true, false, false, true, new object());
status.CreateAndHoldSavepoint( savepoint );
Assert.IsTrue( status.HasSavepoint );
Assert.AreEqual( savepoint, status.Savepoint );
status.RollbackToHeldSavepoint();
saveMgr.Verify();
}
示例5: DefaultConstructorTests
public void DefaultConstructorTests()
{
ISmartTransactionObject txn = MockRepository.GenerateMock<ISmartTransactionObject>();
DefaultTransactionStatus stat = new DefaultTransactionStatus(txn, true, false, false, true, new object());
Assert.IsNotNull(stat.Transaction);
Assert.IsTrue(!stat.ReadOnly);
Assert.IsTrue(!stat.NewSynchronization);
Assert.IsNotNull(stat.SuspendedResources);
Assert.IsTrue(stat.IsNewTransaction);
Assert.IsTrue(! stat.RollbackOnly);
stat.SetRollbackOnly();
Assert.IsTrue(stat.RollbackOnly);
txn.AssertWasCalled(x => x.RollbackOnly, constraints => constraints.Repeat.Once());
}
示例6: DefaultConstructorTests
public void DefaultConstructorTests()
{
MyMockTxnObject txn = new MyMockTxnObject();
txn.SetExpectedIsRollBackOnlyValue( false );
txn.SetExpectedRollbackOnlyCalls( 1 );
DefaultTransactionStatus stat = new DefaultTransactionStatus( txn, true, false, false, true, new object() );
Assert.IsNotNull( stat.Transaction );
Assert.IsTrue( !stat.ReadOnly );
Assert.IsTrue( !stat.NewSynchronization );
Assert.IsNotNull( stat.SuspendedResources );
Assert.IsTrue( stat.IsNewTransaction );
Assert.IsTrue( ! stat.RollbackOnly );
stat.SetRollbackOnly();
Assert.IsTrue( stat.RollbackOnly );
txn.Verify();
}
示例7: DoSetRollbackOnly
/// <summary>The do set rollback only.</summary>
/// <param name="status">The status.</param>
protected override void DoSetRollbackOnly(DefaultTransactionStatus status)
{
}
示例8: DoCommit
/// <summary>The do commit.</summary>
/// <param name="status">The status.</param>
protected override void DoCommit(DefaultTransactionStatus status)
{
this.log.Debug("Committing resourceless transaction on [" + status.Transaction + "]");
}
示例9: DoRollback
/// <summary>The do rollback.</summary>
/// <param name="status">The status.</param>
protected override void DoRollback(DefaultTransactionStatus status)
{
this.log.Debug("Rolling back resourceless transaction on [" + status.Transaction + "]");
}
示例10: DoRollback
/// <summary>
/// Perform an actual rollback on the given transaction, calls Transaction.Abort().
/// </summary>
/// <param name="status">The status representation of the transaction.</param>
/// <remarks>
/// An implementation does not need to check the new transaction flag.
/// </remarks>
protected override void DoRollback(DefaultTransactionStatus status)
{
MessageQueueTransactionObject txObject = (MessageQueueTransactionObject) status.Transaction;
MessageQueueTransaction transaction = txObject.ResourceHolder.MessageQueueTransaction;
try
{
if (LOG.IsDebugEnabled)
{
LOG.Debug("Committing MessageQueueTransaction");
}
transaction.Abort();
}
catch (MessageQueueException ex)
{
throw new TransactionSystemException("Could not roll back DefaultMessageQueue transaction", ex);
}
}
示例11: DoSetRollbackOnly
/// <summary>
/// Set the given transaction rollback-only. Only called on rollback
/// if the current transaction takes part in an existing one.
/// </summary>
/// <param name="status">The status representation of the transaction.</param>
/// <remarks>Default implementation throws an IllegalTransactionStateException,
/// assuming that participating in existing transactions is generally not
/// supported. Subclasses are of course encouraged to provide such support.
/// </remarks>
/// <exception cref="Spring.Transaction.TransactionException">
/// In the case of system errors.
/// </exception>
protected override void DoSetRollbackOnly(DefaultTransactionStatus status)
{
MessageQueueTransactionObject txObject = (MessageQueueTransactionObject) status.Transaction;
txObject.ResourceHolder.RollbackOnly = true;
}
示例12: DoRollback
/// <summary>The do rollback.</summary>
/// <param name="status">The status.</param>
protected override void DoRollback(DefaultTransactionStatus status) { }
示例13: DoSetRollbackOnly
/// <summary>Do set rollback only.</summary>
/// <param name="status">The status.</param>
protected override void DoSetRollbackOnly(DefaultTransactionStatus status)
{
var transactionObject = (RabbitTransactionObject)status.Transaction;
transactionObject.ResourceHolder.RollbackOnly = true;
}
示例14: TriggerAfterCommit
private void TriggerAfterCommit(DefaultTransactionStatus status)
{
if (status.NewSynchronization)
{
if (status.Debug)
{
log.Debug("Trigger AfterCommit Synchronization");
}
IList synchronizations = TransactionSynchronizationManager.Synchronizations;
foreach (ITransactionSynchronization currentTxnSynchronization in synchronizations)
{
try
{
currentTxnSynchronization.AfterCommit();
}
catch (Exception e)
{
log.Error("TransactionSynchronization.AfterCommit thew exception", e);
}
}
}
}
示例15: DoRollback
protected override void DoRollback(DefaultTransactionStatus status)
{
PromotableTxScopeTransactionObject txObject =
(PromotableTxScopeTransactionObject)status.Transaction;
try
{
txObject.TxScopeAdapter.Dispose();
}
catch (Exception e)
{
throw new Spring.Transaction.TransactionSystemException("Failure on Transaction Scope rollback.", e);
}
}