示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
 private BaTransaction(BaDatabase db)
 {
     Database = db;
 }