Method AddParamIf
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
AddParamIf(bool, string, object, TDbType, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf(bool condition, string name, object value, TDbType type, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolThe condition to add the param by. Only adds if true.
namestringThe name of the parameter.
valueobjectThe value of the parameter.
typeTDbTypeThe database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis blank.
AddParamIf<T>(bool, string, T?, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf<T>(bool condition, string name, T? value, ParameterDirection direction = ParameterDirection.Input) where T : struct
Parameters
conditionboolThe condition to add the param by. Only adds if true.
namestringThe name of the parameter.
valueT?The value of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Type Parameters
T
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis blank.
AddParamIf(bool, string, object?, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf(bool condition, string name, object? value, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolThe condition to add the param by. Only adds if true.
namestringThe name of the parameter.
valueobjectThe value of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis blank.
AddParamIf<T>(bool, string, T?, TDbType?, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf<T>(bool condition, string name, T? value, TDbType? type, ParameterDirection direction = ParameterDirection.Input) where T : struct
Parameters
conditionboolThe condition to add the param by. Only adds if true.
namestringThe name of the parameter.
valueT?The value of the parameter.
typeTDbType?The database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Type Parameters
T
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis blank.
AddParamIf(bool, string, int, TDbType?, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf(bool condition, string name, int value, TDbType? type = null, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolThe condition to add the param by. Only adds if true.
namestringThe name of the parameter.
valueintThe value of the parameter.
typeTDbType?The database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis blank.
AddParamIf(bool, string, long, TDbType?, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf(bool condition, string name, long value, TDbType? type = null, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolThe condition to add the param by. Only adds if true.
namestringThe name of the parameter.
valuelongThe value of the parameter.
typeTDbType?The database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis blank.
AddParamIf(bool, string, TDbType, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf(bool condition, string name, TDbType type, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolThe condition to add the param by. Only adds if true.
namestringThe name of the parameter.
typeTDbTypeThe database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis blank.
AddParamIf(bool, string, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf(bool condition, string name, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolThe condition to add the param by. Only adds if true.
namestringThe name of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis blank.