本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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);
示例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;
}
示例6: TransactionWithExceptionNoOp
private object TransactionWithExceptionNoOp(ITransactionStatus status)
{
return null;
}
示例7: TransactionWithExceptionOnRollbackMethod
private object TransactionWithExceptionOnRollbackMethod(ITransactionStatus status)
{
status.SetRollbackOnly();
return null;
}
示例8: TransactionWithPropagationNestedAndRollbackMethod
private object TransactionWithPropagationNestedAndRollbackMethod(ITransactionStatus status)
{
Assert.IsTrue(status.IsNewTransaction, "Is new transaction");
status.SetRollbackOnly();
return null;
}
示例9: TransactionWithPropagationNestedMethod
private object TransactionWithPropagationNestedMethod(ITransactionStatus status)
{
Assert.IsTrue(status.IsNewTransaction, "Is new transaction");
return null;
}
示例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;
}
示例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");
}
示例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());
}
示例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)
//.........这里部分代码省略.........