/// <summary> /// Starts a new transaction. /// </summary> internal static BaTransaction Begin(BaDatabase db) { var bat = new BaTransaction(db); bat.mPreviousTransaction = db.Transaction; // Support nested transactions. NOTE: Sql Server does not support nested tranactions. bat.Transaction = db.Connection.BeginTransaction(); return(bat); }
/// <summary> /// Starts a new transaction. /// </summary> /// <returns></returns> internal static async Task <BaTransaction> BeginAsync(BaDatabase db) { var bat = new BaTransaction(db); bat.mPreviousTransaction = db.Transaction; // Support nested transactions. var conn = await db.GetConnectionAsync().ConfigureAwait(false); bat.Transaction = conn.BeginTransaction(); return(bat); }
private BaTransaction(BaDatabase db) { Database = db; }