Table of Contents

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

condition bool

true to add the parameter; otherwise, false.

value T

The value of the parameter.

expression string

The text of the argument, supplied by the compiler. Do not pass it.

Returns

TThis

This instance for use in method chaining.

Type Parameters

T

The type of the value.

Exceptions

ArgumentException

condition is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value object

The value of the parameter.

type TDbType

The database type of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value T?

The value of the parameter.

direction ParameterDirection

The direction of the parameter.

Returns

TThis

This instance for use in method chaining.

Type Parameters

T

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value object

The value of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value string

The value 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value T?

The value of the parameter.

type TDbType?

The database type of the parameter.

direction ParameterDirection

The direction of the parameter.

Returns

TThis

This instance for use in method chaining.

Type Parameters

T

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value int

The value of the parameter.

type TDbType?

The database type of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value long

The value of the parameter.

type TDbType?

The database type of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value char

The value of the parameter.

type TDbType?

The database type of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value int

The value of the parameter.

type TDbType

The database type of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value long

The value of the parameter.

type TDbType

The database type of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value char

The value of the parameter.

type TDbType

The database type of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value string

The value of the parameter.

type TDbType

The database type of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

value T?

The value of the parameter.

type TDbType

The database type of the parameter.

direction ParameterDirection

The direction of the parameter.

Returns

TThis

This instance for use in method chaining.

Type Parameters

T

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

type TDbType

The database type of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is 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

condition bool

true to add the parameter; otherwise, false.

name string

The name of the parameter.

direction ParameterDirection

The 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

name is null.

ArgumentException

name is empty or white space.