예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BatchCommander"/> class.
 /// </summary>
 /// <param name="db">The db.</param>
 /// <param name="batchSize">Size of the batch.</param>
 public BatchCommander(Database db, int batchSize)
     : this(db, batchSize, db.BeginTransaction())
 {
     isUsingOutsideTransaction = false;
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BatchCommander"/> class.
        /// </summary>
        /// <param name="db">The db.</param>
        /// <param name="batchSize">Size of the batch.</param>
        /// <param name="tran">The tran.</param>
        public BatchCommander(Database db, int batchSize, DbTransaction tran)
        {
            Check.Require(db != null, "db could not be null.");
            Check.Require(batchSize > 0, "Arguments error - batchSize should > 0.");

            this.db = db;
            this.batchSize = batchSize;
            batchCommands = new List<DbCommand>(batchSize);
            this.tran = tran;
            if (tran != null)
            {
                isUsingOutsideTransaction = true;
            }

        }