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
queryMappedQuery<T>The query, made from a DbQuery definition: by
Usingon a MappedDbQuery<T>, or after an earlierAddParam.namestringThe name of the parameter, with or without its prefix.
valueTValueThe value.
Returns
- MappedQuery<T>
A new query with the parameter;
queryis not changed.
Type Parameters
TThe type each row is mapped to.
TValueThe type of the value.
Exceptions
- ArgumentNullException
nameis null.- InvalidOperationException
querywas 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
queryMappedQuery<T>The query, made from a DbQuery definition: by
Usingon a MappedDbQuery<T>, or after an earlierAddParam.namestringThe name of the parameter, with or without its prefix.
valuestringThe value.
Returns
- MappedQuery<T>
A new query with the parameter;
queryis not changed.
Type Parameters
TThe type each row is mapped to.
Exceptions
- ArgumentNullException
nameis null.- InvalidOperationException
querywas 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
queryMappedQuery<T>The query, made from a DbQuery definition: by
Usingon a MappedDbQuery<T>, or after an earlierAddParam.valueTValueThe value.
expressionstringThe text of the argument, supplied by the compiler. Do not pass it.
Returns
- MappedQuery<T>
A new query with the parameter;
queryis not changed.
Type Parameters
TThe type each row is mapped to.
TValueThe type of the value.
Exceptions
- ArgumentException
A name cannot be derived from the argument.
- InvalidOperationException
querywas not made from a DbQuery definition.