Table of Contents

Method AddParam

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

AddParam<TValue>(string, TValue)

Adds an input parameter named as you write it.

public BoundCall<TKind> AddParam<TValue>(string name, TValue value)

Parameters

name string

The name of the parameter.

value TValue

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

Returns

BoundCall<TKind>

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

Type Parameters

TValue

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 BoundCall<TKind> 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

BoundCall<TKind>

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<TValue>(TValue, string?)

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

public BoundCall<TKind> AddParam<TValue>(TValue value, string? expression = null)

Parameters

value TValue

The value of the parameter.

expression string

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

Returns

BoundCall<TKind>

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

Type Parameters

TValue

Exceptions

ArgumentException

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