diff --git a/src/Hangfire.SqlServer/DbCommandExtensions.cs b/src/Hangfire.SqlServer/DbCommandExtensions.cs index 96b38dbec..07babc82e 100644 --- a/src/Hangfire.SqlServer/DbCommandExtensions.cs +++ b/src/Hangfire.SqlServer/DbCommandExtensions.cs @@ -18,69 +18,70 @@ using System.Data.Common; using Hangfire.Annotations; -namespace Hangfire.SqlServer; - -internal static class DbCommandExtensions +namespace Hangfire.SqlServer { - public static DbCommand Create( - [NotNull] this DbConnection connection, - [NotNull] string text, - CommandType type = CommandType.Text, - int? timeout = null) + internal static class DbCommandExtensions { - if (connection == null) throw new ArgumentNullException(nameof(connection)); - if (text == null) throw new ArgumentNullException(nameof(text)); + public static DbCommand Create( + [NotNull] this DbConnection connection, + [NotNull] string text, + CommandType type = CommandType.Text, + int? timeout = null) + { + if (connection == null) throw new ArgumentNullException(nameof(connection)); + if (text == null) throw new ArgumentNullException(nameof(text)); - var command = connection.CreateCommand(); - command.CommandType = type; - command.CommandText = text; + var command = connection.CreateCommand(); + command.CommandType = type; + command.CommandText = text; - if (timeout.HasValue) - { - command.CommandTimeout = timeout.Value; - } + if (timeout.HasValue) + { + command.CommandTimeout = timeout.Value; + } - return command; - } + return command; + } - public static DbCommand AddParameter( - [NotNull] this DbCommand command, - [NotNull] string parameterName, - [CanBeNull] object value, - DbType dbType, - [CanBeNull] int? size = null) - { - if (command == null) throw new ArgumentNullException(nameof(command)); - if (parameterName == null) throw new ArgumentNullException(nameof(parameterName)); + public static DbCommand AddParameter( + [NotNull] this DbCommand command, + [NotNull] string parameterName, + [CanBeNull] object value, + DbType dbType, + [CanBeNull] int? size = null) + { + if (command == null) throw new ArgumentNullException(nameof(command)); + if (parameterName == null) throw new ArgumentNullException(nameof(parameterName)); - var parameter = command.CreateParameter(); - parameter.ParameterName = parameterName; - parameter.DbType = dbType; - parameter.Value = value ?? DBNull.Value; + var parameter = command.CreateParameter(); + parameter.ParameterName = parameterName; + parameter.DbType = dbType; + parameter.Value = value ?? DBNull.Value; - if (size.HasValue) parameter.Size = size.Value; + if (size.HasValue) parameter.Size = size.Value; - command.Parameters.Add(parameter); - return command; - } + command.Parameters.Add(parameter); + return command; + } - public static DbCommand AddReturnParameter( - [NotNull] this DbCommand command, - string parameterName, - out DbParameter parameter, - DbType dbType, - int? size = null) - { - if (command == null) throw new ArgumentNullException(nameof(command)); + public static DbCommand AddReturnParameter( + [NotNull] this DbCommand command, + string parameterName, + out DbParameter parameter, + DbType dbType, + int? size = null) + { + if (command == null) throw new ArgumentNullException(nameof(command)); - parameter = command.CreateParameter(); - parameter.ParameterName = parameterName; - parameter.DbType = dbType; - parameter.Direction = ParameterDirection.ReturnValue; + parameter = command.CreateParameter(); + parameter.ParameterName = parameterName; + parameter.DbType = dbType; + parameter.Direction = ParameterDirection.ReturnValue; - if (size.HasValue) parameter.Size = size.Value; + if (size.HasValue) parameter.Size = size.Value; - command.Parameters.Add(parameter); - return command; + command.Parameters.Add(parameter); + return command; + } } } \ No newline at end of file