Table of Contents

Method AddParam

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

AddParam<T, TValue>(MappedQuery<T>, string, TValue)

Adds a named parameter to the query.

public static MappedQuery<T> AddParam<T, TValue>(this MappedQuery<T> query, string name, TValue value)

Parameters

query MappedQuery<T>

The query, made from a DbQuery definition: by Using on a MappedDbQuery<T>, or after an earlier AddParam.

name string

The name of the parameter, with or without its prefix.

value TValue

The value.

Returns

MappedQuery<T>

A new query with the parameter; query is not changed.

Type Parameters

T

The type each row is mapped to.

TValue

The type of the value.

Exceptions

ArgumentNullException

name is null.

InvalidOperationException

query was not made from a DbQuery definition.

AddParam<T>(MappedQuery<T>, string, string?)

Adds a named parameter to the query.

public static MappedQuery<T> AddParam<T>(this MappedQuery<T> query, string name, string? value)

Parameters

query MappedQuery<T>

The query, made from a DbQuery definition: by Using on a MappedDbQuery<T>, or after an earlier AddParam.

name string

The name of the parameter, with or without its prefix.

value string

The value.

Returns

MappedQuery<T>

A new query with the parameter; query is not changed.

Type Parameters

T

The type each row is mapped to.

Exceptions

ArgumentNullException

name is null.

InvalidOperationException

query was not made from a DbQuery definition.

AddParam<T, TValue>(MappedQuery<T>, TValue, string?)

Adds a parameter whose name is derived from the argument's expression.

public static MappedQuery<T> AddParam<T, TValue>(this MappedQuery<T> query, TValue value, string? expression = null)

Parameters

query MappedQuery<T>

The query, made from a DbQuery definition: by Using on a MappedDbQuery<T>, or after an earlier AddParam.

value TValue

The value.

expression string

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

Returns

MappedQuery<T>

A new query with the parameter; query is not changed.

Type Parameters

T

The type each row is mapped to.

TValue

The type of the value.

Exceptions

ArgumentException

A name cannot be derived from the argument.

InvalidOperationException

query was not made from a DbQuery definition.