本文整理汇总了C#中System.Transactions.Transaction.EnlistDurable方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.EnlistDurable方法的具体用法?C# Transaction.EnlistDurable怎么用?C# Transaction.EnlistDurable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Transactions.Transaction
的用法示例。
在下文中一共展示了Transaction.EnlistDurable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Enlist
public void Enlist(Transaction tx)
{
tx.EnlistDurable(_transactionExecutionEnvironment.ResourceManagerId, this, EnlistmentOptions.None);
}
示例2: Enlist
public void Enlist(Transaction tx)
{
tx.EnlistDurable(TransactionResourceId, this, EnlistmentOptions.None);
}
示例3: EnlistTransaction
public override void EnlistTransaction(Transaction systemTransaction)
{
lock (m_syncRoot)
{
CheckClosed();
if (systemTransaction == null)
{
throw new ArgumentNullException("transaction");
}
HsqlEnlistment enlistment = m_enlistment;
if (enlistment == null)
{
enlistment = new HsqlEnlistment(this, systemTransaction);
if (!systemTransaction.EnlistPromotableSinglePhase(enlistment))
{
if (m_transaction == null)
{
BeginTransaction(HsqlConvert.ToIsolationLevel(systemTransaction.IsolationLevel));
}
enlistment.m_dbTransaction = m_transaction;
systemTransaction.EnlistDurable(enlistment.Rmid, enlistment, EnlistmentOptions.None);
}
m_enlistment = enlistment;
GC.KeepAlive(this);
}
else if (enlistment.Transaction != systemTransaction)
{
throw new InvalidOperationException(
"Connection currently has transaction enlisted."
+ " Finish current transaction and retry."); // NOI18N
}
}
}
示例4: Enlist
public Transaction Enlist(Transaction tx)
{
tx.EnlistDurable(rmGuid, this, EnlistmentOptions.None);
return tx;
}
示例5: Begin
public void Begin(Transaction transaction)
{
lock (syncObject)
{
this.netTxState = TxState.Active;
dtcControlEvent.Reset();
Tracer.Debug("Begin notification received");
if (InNetTransaction)
{
throw new TransactionInProgressException("A Transaction is already in Progress");
}
try
{
Guid rmId = ResourceManagerGuid;
// Enlist this object in the transaction.
this.currentEnlistment =
transaction.EnlistDurable(rmId, this, EnlistmentOptions.None);
Tracer.Debug("Enlisted in Durable Transaction with RM Id: " + rmId);
TransactionInformation txInfo = transaction.TransactionInformation;
XATransactionId xaId = new XATransactionId();
this.transactionId = xaId;
if (txInfo.DistributedIdentifier != Guid.Empty)
{
xaId.GlobalTransactionId = txInfo.DistributedIdentifier.ToByteArray();
xaId.BranchQualifier = Encoding.UTF8.GetBytes(Guid.NewGuid().ToString());
}
else
{
xaId.GlobalTransactionId = Encoding.UTF8.GetBytes(txInfo.LocalIdentifier);
xaId.BranchQualifier = Encoding.UTF8.GetBytes(Guid.NewGuid().ToString());
}
// Now notify the broker that a new XA'ish transaction has started.
TransactionInfo info = new TransactionInfo();
info.ConnectionId = this.connection.ConnectionId;
info.TransactionId = this.transactionId;
info.Type = (int) TransactionType.Begin;
this.session.Connection.Oneway(info);
if (Tracer.IsDebugEnabled)
{
Tracer.Debug("Began XA'ish Transaction:" + xaId.GlobalTransactionId.ToString());
}
}
catch (Exception)
{
dtcControlEvent.Set();
throw;
}
}
}