Beispiel #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>
        /// <param name="il">The il.</param>
        public BatchCommander(Database db, int batchSize, IsolationLevel il)
            : this(db, batchSize)
        {
            Check.Require(db != null, "db could not be null.");
            Check.Require(batchSize > 0, "Arguments error - batchSize should > 0.");

            tran = db.BeginTransaction(il);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes the <see cref="T:Database"/> class.
 /// </summary>
 static Database()
 {
     if (DbProviders.DbProviderFactory.Default == null)
     {
         Default = null;
     }
     else
     {
         Default = new Database(DbProviders.DbProviderFactory.Default);
     }
 }
Beispiel #3
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)
            : this(db, batchSize)
        {
            Check.Require(db != null, "db could not be null.");
            Check.Require(batchSize > 0, "Arguments error - batchSize should > 0.");

            this.tran = tran;
            if (tran != null)
            {
                isUsingOutsideTransaction = true;
            }
        }
Beispiel #4
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)
        {
            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);

            if (!db.DbProvider.Options.SupportMultiSqlStatementInOneCommand)
            {
                this.batchSize = 1;
            }
        }
Beispiel #5
0
 public SQLTranscation(Database db)
 {
     this.transation = db.BeginTransaction();
     this.db = db;
 }
Beispiel #6
0
 public CallerService()
 {
     if (_db == null)
         _db = new Database("DefaultConnection");
 }