internal static SqlCommand CreateCommand( SqlConnection connection, string sqlCommand, CommandType commandType, IEnumerable <IDataParameter> parameters, DbSetting databaseSetting) { if (connection == null) { throw new ArgumentNullException(nameof(connection)); } if (sqlCommand == null) { throw new ArgumentNullException(nameof(sqlCommand)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } if (databaseSetting == null) { throw new ArgumentNullException(nameof(databaseSetting)); } var command = new SqlCommand(sqlCommand, connection) { CommandType = commandType, CommandTimeout = databaseSetting.Timeout }; foreach (var parameter in parameters) { command.Parameters.Add(parameter); } return(command); }
public virtual IDataReader ExecuteSelect(string storedProcedureName, IEnumerable <IDataParameter> parameters, DbSetting databaseSetting) { return(ExecuteHelper.ExecuteSelect(storedProcedureName, CommandType.StoredProcedure, parameters, databaseSetting)); }