/// <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); }
/// <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); } }
/// <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; } }
/// <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; } }
public SQLTranscation(Database db) { this.transation = db.BeginTransaction(); this.db = db; }
public CallerService() { if (_db == null) _db = new Database("DefaultConnection"); }