public SqlCommandBatch(bool preferBatching) { if (SqlCommandSet.IsAvailable && preferBatching) { try { _commandSet = new SqlCommandSet(); _defaultTimeout = _commandSet.BatchCommand.CommandTimeout; } catch (Exception) { _commandSet = null; } } }
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; } } }