Table of Contents

Method AddParam

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

AddParam<T>(string, T)

Adds an input parameter named as you write it.

public DbQueryCall AddParam<T>(string name, T value)

Parameters

name string

The name of the parameter.

value T

The value of the parameter. A null is sent as a database null, typed as T is.

Returns

DbQueryCall

A new query holding the value; this one is not changed.

Type Parameters

T

The type of the value.

Remarks

For the lightest call, declare the values with Params<TParams>() and a readonly record struct.

Exceptions

ArgumentNullException

name is null.

ArgumentException

name is empty or white space.

AddParam(string, string?)

Adds an input parameter with a string value.

public DbQueryCall AddParam(string name, string? value)

Parameters

name string

The name of the parameter.

value string

The value of the parameter. A null is sent as a database null, typed as T is.

Returns

DbQueryCall

A new query holding the value; this one is not changed.

Remarks

For the lightest call, declare the values with Params<TParams>() and a readonly record struct.

Exceptions

ArgumentNullException

name is null.

ArgumentException

name is empty or white space.

AddParam<T>(T, string?)

Adds an input parameter named for the argument: AddParam(authorId) adds authorId, AddParam(filter.AuthorId) adds AuthorId.

public DbQueryCall AddParam<T>(T value, string? expression = null)

Parameters

value T

The value of the parameter.

expression string

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

Returns

DbQueryCall

A new query holding the value; this one is not changed.

Type Parameters

T

The type of the value.

Exceptions

ArgumentException

A name cannot be derived from the argument (it is not a variable or a chain of members).