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


C# ITransactionStatus类代码示例

本文整理汇总了C#中ITransactionStatus的典型用法代码示例。如果您正苦于以下问题:C# ITransactionStatus类的具体用法?C# ITransactionStatus怎么用?C# ITransactionStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITransactionStatus类属于命名空间,在下文中一共展示了ITransactionStatus类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CommitTxDelegate

 public object CommitTxDelegate(ITransactionStatus status)
 {
     Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive);
     Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly);
    
     return null;
 }
开发者ID:fgq841103,项目名称:spring-net,代码行数:7,代码来源:TxScopeTransactionManagerIntegrationTests.cs

示例2: DoInTransaction

        public object DoInTransaction(ITransactionStatus status)
        {
            Assert.IsTrue(TransactionSynchronizationManager.HasResource(dbProvider), "Has thread db provider");
            Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive, "Synchronizations active");
            Assert.IsTrue(status.IsNewTransaction, "Is new transaction");
            Assert.AreSame(connection2, ConnectionUtils.GetConnection(dbProvider));
            Assert.AreSame(connection2, ConnectionUtils.GetConnection(dbProvider));

            return null;
        }
开发者ID:serra,项目名称:spring-net,代码行数:10,代码来源:AdoPlatformTransactionManagerTests.cs

示例3: DoInTransaction

        public object DoInTransaction(ITransactionStatus status)
        {


            Assert.IsTrue(!TransactionSynchronizationManager.HasResource(sf), "Hasn't thread session");
            Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly);
            Assert.IsFalse(TransactionSynchronizationManager.ActualTransactionActive);

            HibernateTemplate ht = new HibernateTemplate(sf);
            ht.TemplateFlushMode = TemplateFlushMode.Eager;
            return ht.ExecuteFind(new NotSupportedTxCallbackInner());
        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:12,代码来源:HibernateTransactionManagerTests.cs

示例4: DoInTransactionWithoutResult

 /// <summary>
 /// Gets called by TransactionTemplate.execute within a transactional context
 /// when no return value is required.
 /// </summary>
 /// <param name="status">The status.</param>
 /// <remarks>
 /// Does not need to care about transactions itself, although it can retrieve
 /// and influence the status of the current transaction via the given status
 /// object, e.g. setting rollback-only.
 /// A RuntimeException thrown by the callback is treated as application
 /// exception that enforces a rollback. An exception gets propagated to the
 /// caller of the template.
 /// </remarks>
 public abstract void DoInTransactionWithoutResult(ITransactionStatus status);
开发者ID:spring-projects,项目名称:spring-net,代码行数:14,代码来源:TransactionCallbackWithoutResult.cs

示例5: DoInTransaction

 /// <summary>
 /// Gets called by TransactionTemplate.Execute within a
 /// transaction context.
 /// </summary>
 /// <param name="status">The associated transaction status.</param>
 /// <returns>a result object or <c>null</c></returns>
 public object DoInTransaction(ITransactionStatus status)
 {
     DoInTransactionWithoutResult(status);
     return null;
 }
开发者ID:spring-projects,项目名称:spring-net,代码行数:11,代码来源:TransactionCallbackWithoutResult.cs

示例6: TransactionWithExceptionNoOp

 private object TransactionWithExceptionNoOp(ITransactionStatus status)
 {
     return null;
 }
开发者ID:serra,项目名称:spring-net,代码行数:4,代码来源:AdoPlatformTransactionManagerTests.cs

示例7: TransactionWithExceptionOnRollbackMethod

 private object TransactionWithExceptionOnRollbackMethod(ITransactionStatus status)
 {
     status.SetRollbackOnly();
     return null;
 }
开发者ID:serra,项目名称:spring-net,代码行数:5,代码来源:AdoPlatformTransactionManagerTests.cs

示例8: TransactionWithPropagationNestedAndRollbackMethod

 private object TransactionWithPropagationNestedAndRollbackMethod(ITransactionStatus status)
 {
     Assert.IsTrue(status.IsNewTransaction, "Is new transaction");
     status.SetRollbackOnly();
     return null;
 }
开发者ID:serra,项目名称:spring-net,代码行数:6,代码来源:AdoPlatformTransactionManagerTests.cs

示例9: TransactionWithPropagationNestedMethod

 private object TransactionWithPropagationNestedMethod(ITransactionStatus status)
 {
     Assert.IsTrue(status.IsNewTransaction, "Is new transaction");
     return null;
 }
开发者ID:serra,项目名称:spring-net,代码行数:5,代码来源:AdoPlatformTransactionManagerTests.cs

示例10: TransactionMethod

 private object TransactionMethod(ITransactionStatus status)
 {
     Assert.IsTrue(TransactionSynchronizationManager.HasResource(sf), "Has thread session");
     HibernateTemplate ht = new HibernateTemplate(sf);
     object returnValue = ht.Execute(new HibernateDelegate(Del));
     status.SetRollbackOnly();
     return null;
 }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:8,代码来源:HibernateTransactionManagerTests.cs

示例11: DoInTransaction

 /// <summary>
 /// Gets called by TransactionTemplate.Execute within a 
 /// transaction context.
 /// </summary>
 /// <param name="status">The associated transaction status.</param>
 /// <returns>a result object or <c>null</c></returns>
 public object DoInTransaction(ITransactionStatus status)
 {
     return dao.FindByName("Gabriel");
 }
开发者ID:fgq841103,项目名称:spring-net,代码行数:10,代码来源:TemplateTests.cs

示例12: DoInTransaction

 /// <summary>
 /// Gets called by TransactionTemplate.Execute within a 
 /// transaction context.
 /// </summary>
 /// <param name="status">The associated transaction status.</param>
 /// <returns>a result object or <c>null</c></returns>
 public object DoInTransaction(ITransactionStatus status)
 {
     AdoTemplate adoTemplate = new AdoTemplate(dbProvider);
     return adoTemplate.Execute(new TestCommandCallback());
 }
开发者ID:smnbss,项目名称:spring-net,代码行数:11,代码来源:TransactionTemplateTests.cs

示例13: DoReceiveAndExecuteUsingPlatformTransactionManager

        /// <summary>
        /// Does the receive and execute using TxPlatformTransactionManager.  Starts a distributed
        /// transaction before calling Receive.
        /// </summary>
        /// <param name="mq">The message queue.</param>
        /// <param name="status">The transactional status.</param>
        /// <returns>
        /// true if should continue peeking, false otherwise.
        /// </returns>
        protected override bool DoReceiveAndExecuteUsingPlatformTransactionManager(MessageQueue mq,
                                                                                   ITransactionStatus status)
        {
            #region Logging

            if (LOG.IsDebugEnabled)
            {
                LOG.Debug("Executing DoReceiveAndExecuteUsingTxScopeTransactionManager");
            }

            #endregion Logging

            //We are sure to be talking to a second resource manager, so avoid going through
            //the promotable transaction and force a distributed transaction right from the start.
            TransactionInterop.GetTransmitterPropagationToken(System.Transactions.Transaction.Current);

            Message message;
            try
            {
                message = mq.Receive(TimeSpan.Zero, MessageQueueTransactionType.Automatic);
            }
            catch (MessageQueueException ex)
            {
                if (ex.MessageQueueErrorCode == MessageQueueErrorCode.IOTimeout)
                {
                    //expected to occur occasionally

                    #region Logging

                    if (LOG.IsTraceEnabled)
                    {
                        LOG.Trace(
                            "MessageQueueErrorCode.IOTimeout: No message available to receive.  May have been processed by another thread.");
                    }

                    #endregion

                    status.SetRollbackOnly();
                    return false; // no more peeking unless this is the last listener thread
                }
                else
                {
                    // A real issue in receiving the message
                    lock (messageQueueMonitor)
                    {
                        mq.Close();
                        MessageQueue.ClearConnectionCache();
                    }
                    throw; // will cause rollback in surrounding platform transaction manager and log exception
                }
            }

            if (message == null)
            {
                #region Logging

                if (LOG.IsTraceEnabled)
                {
                    LOG.Trace("Message recieved is null from Queue = [" + mq.Path + "]");
                }

                #endregion

                status.SetRollbackOnly();
                return false; // no more peeking unless this is the last listener thread
            }


            try
            {
                #region Logging

                if (LOG.IsDebugEnabled)
                {
                    LOG.Debug("Received message [" + message.Id + "] on queue [" + mq.Path + "]");
                }

                #endregion

                MessageReceived(message);
                if (DistributedTransactionExceptionHandler != null)
                {
                    if (DistributedTransactionExceptionHandler.IsPoisonMessage(message))
                    {
                        DistributedTransactionExceptionHandler.HandlePoisonMessage(message);
                        return true; // will remove from queue and continue receive loop.
                    }
                }
                DoExecuteListener(message);
            }
            catch (Exception ex)
//.........这里部分代码省略.........
开发者ID:fgq841103,项目名称:spring-net,代码行数:101,代码来源:DistributedTxMessageListenerContainer.cs


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