/// <summary> /// Initializes a new instance of the <see cref="IsamTransaction"/> class. /// Begin a transaction on the given session. /// </summary> /// <param name="isamSession"> /// The session we will use for the transaction. /// </param> /// <remarks> /// If this transaction is not committed before this object is disposed /// then the transaction will automatically be aborted. /// </remarks> public IsamTransaction(IsamSession isamSession) { lock (isamSession) { this.isamSession = isamSession; this.isamSession.BeginTransaction(); this.transactionLevel = isamSession.TransactionLevel; this.transactionLevelID = isamSession.TransactionLevelID(isamSession.TransactionLevel); this.cleanup = true; } }
/// <summary> /// Initializes a new instance of the <see cref="IsamTransaction"/> class. /// Begin a transaction on the given session. /// </summary> /// <param name="isamSession"> /// The session we will use for the transaction. /// </param> /// <remarks> /// If this transaction is not committed before this object is disposed /// then the transaction will automatically be aborted. /// </remarks> public IsamTransaction(IsamSession isamSession) { lock (isamSession) { this.isamSession = isamSession; this.isamSession.BeginTransaction(); this.transactionLevel = isamSession.TransactionLevel; this.transactionLevelID = isamSession.TransactionLevelID(isamSession.TransactionLevel); this.cleanup = true; } }
/// <summary> /// Initializes a new instance of the <see cref="IsamTransaction"/> class. /// Joins the current transaction on the given session. If the session /// is not currently in a transaction then a new transaction will be /// begun. /// </summary> /// <param name="isamSession"> /// The session we will use for the transaction. /// </param> /// <param name="join"> /// If true, the current transaction on the session will be joined. If false or if there is no current transaction then a new transaction will be begun. /// </param> /// <remarks> /// If an existing transaction is joined, then committing or aborting /// this transaction will have no effect on the joined transaction. If /// a new transaction was begun then these actions will work normally. /// <para> /// If this transaction is not committed before this object is disposed /// then the transaction will automatically be aborted. /// </para> /// </remarks> public IsamTransaction(IsamSession isamSession, bool join) { lock (isamSession) { this.isamSession = isamSession; if (!join || isamSession.TransactionLevel == 0) { this.isamSession.BeginTransaction(); this.transactionLevel = isamSession.TransactionLevel; this.transactionLevelID = isamSession.TransactionLevelID(isamSession.TransactionLevel); this.cleanup = true; } } }
/// <summary> /// Initializes a new instance of the <see cref="IsamTransaction"/> class. /// Joins the current transaction on the given session. If the session /// is not currently in a transaction then a new transaction will be /// begun. /// </summary> /// <param name="isamSession"> /// The session we will use for the transaction. /// </param> /// <param name="join"> /// If true, the current transaction on the session will be joined. If false or if there is no current transaction then a new transaction will be begun. /// </param> /// <remarks> /// If an existing transaction is joined, then committing or aborting /// this transaction will have no effect on the joined transaction. If /// a new transaction was begun then these actions will work normally. /// <para> /// If this transaction is not committed before this object is disposed /// then the transaction will automatically be aborted. /// </para> /// </remarks> public IsamTransaction(IsamSession isamSession, bool join) { lock (isamSession) { this.isamSession = isamSession; if (!join || isamSession.TransactionLevel == 0) { this.isamSession.BeginTransaction(); this.transactionLevel = isamSession.TransactionLevel; this.transactionLevelID = isamSession.TransactionLevelID(isamSession.TransactionLevel); this.cleanup = true; } } }