Method AddParamIf
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
AddParamIf<T>(bool, T, string?)
Conditionally adds an input parameter whose name is taken from the argument expression. See AddParam<T>(T, string?).
public TThis AddParamIf<T>(bool condition, T value, string? expression = null)
Parameters
conditionboolvalueTThe value of the parameter.
expressionstringThe text of the argument, supplied by the compiler. Do not pass it.
Returns
- TThis
This instance for use in method chaining.
Type Parameters
TThe type of the value.
Exceptions
- ArgumentException
conditionis true and a parameter name cannot be derived from the argument. When it is false, nothing is added and the argument is not looked at.
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
conditionboolnamestringThe 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.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
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
conditionboolnamestringThe 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
TThe type of the value.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
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
conditionboolnamestringThe name of the parameter.
valueobjectThe value of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
AddParamIf(bool, string, string?)
Conditionally adds an input parameter with a string value, named as you write it.
public TThis AddParamIf(bool condition, string name, string? value)
Parameters
Returns
- TThis
This instance for use in method chaining.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
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
conditionboolnamestringThe 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
TThe type of the value.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
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
conditionboolnamestringThe 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.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
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
conditionboolnamestringThe 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.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
AddParamIf(bool, string, char, TDbType?, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf(bool condition, string name, char value, TDbType? type = null, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolnamestringThe name of the parameter.
valuecharThe 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.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
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, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolnamestringThe name of the parameter.
valueintThe value of the parameter.
typeTDbTypeThe database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
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, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolnamestringThe name of the parameter.
valuelongThe value of the parameter.
typeTDbTypeThe database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
AddParamIf(bool, string, char, TDbType, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf(bool condition, string name, char value, TDbType type, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolnamestringThe name of the parameter.
valuecharThe value of the parameter.
typeTDbTypeThe database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
AddParamIf(bool, string, string?, TDbType, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf(bool condition, string name, string? value, TDbType type, ParameterDirection direction = ParameterDirection.Input)
Parameters
conditionboolnamestringThe name of the parameter.
valuestringThe value of the parameter.
typeTDbTypeThe database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
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
conditionboolnamestringThe name of the parameter.
valueT?The value of the parameter.
typeTDbTypeThe database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Type Parameters
TThe type of the value.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
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
conditionboolnamestringThe name of the parameter.
typeTDbTypeThe database type of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.
AddParamIf(bool, string, ParameterDirection)
Conditionally adds a parameter to the params list.
public TThis AddParamIf(bool condition, string name, ParameterDirection direction)
Parameters
conditionboolnamestringThe name of the parameter.
directionParameterDirectionThe direction of the parameter.
Returns
- TThis
This instance for use in method chaining.
Remarks
A null value passed to an overload
whose argument has a static type
(a nullable value type, or a string)
is sent with the database type of that type,
the same choice AddParams makes for a NULL member.
A type you pass always wins.
The object overloads have no type to use,
and neither does a call that gives the direction by position
(AddParam(name, value, ParameterDirection.Input)):
pass a database type, or name the direction
(direction: ...).
Exceptions
- ArgumentNullException
nameis null.- ArgumentException
nameis empty or white space.