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