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
namestringThe name of the parameter.
valueTThe value of the parameter. A null is sent as a database null, typed as
Tis.
Returns
- DbQueryCall
A new query holding the value; this one is not changed.
Type Parameters
TThe type of the value.
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 DbQueryCall 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
- 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
nameis null.- ArgumentException
nameis 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
valueTThe value of the parameter.
expressionstringThe 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
TThe type of the value.
Exceptions
- ArgumentException
A name cannot be derived from the argument (it is not a variable or a chain of members).