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 PendingCall<ScalarKind<T>> AddParam<TValue>(string name, TValue value)
Parameters
namestringThe name of the parameter.
valueTValueThe value of the parameter. A null is sent as a database null, typed as
Tis.
Returns
- PendingCall<ScalarKind<T>>
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
nameis null.- ArgumentException
nameis empty or white space.
AddParam(string, string?)
Adds an input parameter with a string value.
public PendingCall<ScalarKind<T>> AddParam(string name, string? value)
Parameters
namestringThe name of the parameter.
valuestringThe value of the parameter. A null is sent as a database null, typed as
Tis.
Returns
- PendingCall<ScalarKind<T>>
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
nameis null.- ArgumentException
nameis 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 PendingCall<ScalarKind<T>> AddParam<TValue>(TValue value, string? expression = null)
Parameters
valueTValueThe value of the parameter.
expressionstringThe text of the argument, supplied by the compiler. Do not pass it.
Returns
- PendingCall<ScalarKind<T>>
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).