Ejemplo n.º 1
0
 public SqlCommandBatch(bool preferBatching)
 {
     if (SqlCommandSet.IsAvailable && preferBatching)
     {
         try
         {
             _commandSet     = new SqlCommandSet();
             _defaultTimeout = _commandSet.BatchCommand.CommandTimeout;
         }
         catch (Exception)
         {
             _commandSet = null;
         }
     }
 }
Ejemplo n.º 2
0
        public SqlCommandBatch(DbConnection connection, DbTransaction transaction, bool preferBatching)
        {
            Connection  = connection;
            Transaction = transaction;

            if (connection is SqlConnection && SqlCommandSet.IsAvailable && preferBatching)
            {
                try
                {
                    _commandSet     = new SqlCommandSet();
                    _defaultTimeout = _commandSet.BatchCommand.CommandTimeout;
                }
                catch (Exception)
                {
                    _commandSet = null;
                }
            }
        }