本文整理汇总了C#中BerkeleyDB.Transaction.SetTxnTimeout方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.SetTxnTimeout方法的具体用法?C# Transaction.SetTxnTimeout怎么用?C# Transaction.SetTxnTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BerkeleyDB.Transaction
的用法示例。
在下文中一共展示了Transaction.SetTxnTimeout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeginTransaction
/// <summary>
/// Create a new transaction in the environment.
/// </summary>
/// <remarks>
/// In the presence of distributed transactions and two-phase commit,
/// only the parental transaction, that is a transaction without a
/// parent specified, should be passed as an parameter to
/// <see cref="Transaction.Prepare"/>.
/// </remarks>
/// <param name="cfg">
/// The configuration properties for the transaction
/// </param>
/// <param name="parent">
/// If non-null, the new transaction is a nested transaction,
/// with <paramref name="parent"/> as the new transaction's parent.
/// Transactions may be nested to any level.
/// </param>
/// <returns>A new transaction object</returns>
public Transaction BeginTransaction(
TransactionConfig cfg, Transaction parent)
{
DB_TXN dbtxn = dbenv.txn_begin(
Transaction.getDB_TXN(parent), cfg.flags);
Transaction txn = new Transaction(dbtxn);
if (cfg.lockTimeoutIsSet)
txn.SetLockTimeout(cfg.LockTimeout);
if (cfg.nameIsSet)
txn.Name = cfg.Name;
if (cfg.txnTimeoutIsSet)
txn.SetTxnTimeout(cfg.TxnTimeout);
return txn;
}