当前位置: 首页>>代码示例>>C#>>正文


C# Support.DefaultTransactionStatus类代码示例

本文整理汇总了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);
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:8,代码来源:DefaultTransactionStatusTests.cs

示例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 );
		}
开发者ID:fuadm,项目名称:spring-net,代码行数:9,代码来源:DefaultTransactionStatusTests.cs

示例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));
        }
开发者ID:Binodesk,项目名称:spring-net,代码行数:12,代码来源:DefaultTransactionStatusTests.cs

示例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();
		}
开发者ID:fuadm,项目名称:spring-net,代码行数:14,代码来源:DefaultTransactionStatusTests.cs

示例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());
        }
开发者ID:Binodesk,项目名称:spring-net,代码行数:16,代码来源:DefaultTransactionStatusTests.cs

示例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();
		}
开发者ID:fuadm,项目名称:spring-net,代码行数:17,代码来源:DefaultTransactionStatusTests.cs

示例7: DoSetRollbackOnly

 /// <summary>The do set rollback only.</summary>
 /// <param name="status">The status.</param>
 protected override void DoSetRollbackOnly(DefaultTransactionStatus status)
 {
 }
开发者ID:spring-projects,项目名称:spring-net-retry,代码行数:5,代码来源:ResourcelessTransactionManager.cs

示例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 + "]");
 }
开发者ID:spring-projects,项目名称:spring-net-retry,代码行数:6,代码来源:ResourcelessTransactionManager.cs

示例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 + "]");
 }
开发者ID:spring-projects,项目名称:spring-net-retry,代码行数:6,代码来源:ResourcelessTransactionManager.cs

示例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);
     }
 }
开发者ID:fgq841103,项目名称:spring-net,代码行数:24,代码来源:MessageQueueTransactionManager.cs

示例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;
 }
开发者ID:fgq841103,项目名称:spring-net,代码行数:17,代码来源:MessageQueueTransactionManager.cs

示例12: DoRollback

 /// <summary>The do rollback.</summary>
 /// <param name="status">The status.</param>
 protected override void DoRollback(DefaultTransactionStatus status) { }
开发者ID:yonglehou,项目名称:spring-net-amqp,代码行数:3,代码来源:RabbitTemplateTests.cs

示例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;
 }
开发者ID:yonglehou,项目名称:spring-net-amqp,代码行数:7,代码来源:RabbitTransactionManager.cs

示例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);
             }
         }
     }
 }
开发者ID:fgq841103,项目名称:spring-net,代码行数:22,代码来源:AbstractPlatformTransactionManager.cs

示例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);
            }
        }
开发者ID:Binodesk,项目名称:spring-net,代码行数:15,代码来源:TxScopeTransactionManager.cs


注:本文中的Spring.Transaction.Support.DefaultTransactionStatus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。