Struct SqlParameterConfiguration
- Namespace
- LfrlAnvil.Sql.Statements.Compilers
- Assembly
- LfrlAnvil.Sql.Core.dll
Represents an explicit SQL parameter configuration for ISqlParameterBinderFactory.
public readonly struct SqlParameterConfiguration
- Inherited Members
Properties
CustomSelector
Custom source value selector expression.
public LambdaExpression? CustomSelector { get; }
Property Value
CustomSelectorSourceType
Source type from the CustomSelector.
public Type? CustomSelectorSourceType { get; }
Property Value
CustomSelectorValueType
Value type from the CustomSelector.
public Type? CustomSelectorValueType { get; }
Property Value
IsIgnored
Specifies whether or not the associated source type member should be completely ignored.
public bool IsIgnored { get; }
Property Value
IsIgnoredWhenNull
Specifies whether or not null source values will be completely ignored. Overrides the IgnoreNullValues option when not null.
public bool? IsIgnoredWhenNull { get; }
Property Value
- bool?
MemberName
Source type's field or property name.
public string? MemberName { get; }
Property Value
ParameterIndex
Index of the positional SQL parameter.
public int? ParameterIndex { get; }
Property Value
- int?
TargetParameterName
Name of the SQL parameter.
public string? TargetParameterName { get; }
Property Value
Methods
From(string, string, bool?, int?)
Creates a new SqlParameterConfiguration instance that causes the provided source type member to create an SQL parameter with a different name.
[Pure]
public static SqlParameterConfiguration From(string targetParameterName, string memberName, bool? isIgnoredWhenNull = null, int? parameterIndex = null)
Parameters
targetParameterName
stringName of the SQL parameter.
memberName
stringSource type's field or property name.
isIgnoredWhenNull
bool?Specifies whether or not null source values will be completely ignored. Equal to null by default.
parameterIndex
int?Optional 0-based index to mark the parameter as positional.
Returns
- SqlParameterConfiguration
New SqlParameterConfiguration instance.
Exceptions
- ArgumentOutOfRangeException
When
parameterIndex
is less than 0.
From<TSource, TValue>(string, Expression<Func<TSource, TValue>>, bool?, int?)
Creates a new SqlParameterConfiguration instance that causes the provided SQL parameter to be created from a custom source value selector expression.
[Pure]
public static SqlParameterConfiguration From<TSource, TValue>(string targetParameterName, Expression<Func<TSource, TValue>> selector, bool? isIgnoredWhenNull = null, int? parameterIndex = null)
Parameters
targetParameterName
stringName of the SQL parameter.
selector
Expression<Func<TSource, TValue>>Custom source value selector expression.
isIgnoredWhenNull
bool?Specifies whether or not null source values will be completely ignored. Equal to null by default.
parameterIndex
int?Optional 0-based index to mark the parameter as positional.
Returns
- SqlParameterConfiguration
New SqlParameterConfiguration instance.
Type Parameters
TSource
Parameter source type.
TValue
SQL parameter value type.
Exceptions
- ArgumentOutOfRangeException
When
parameterIndex
is less than 0.
IgnoreMember(string)
Creates a new SqlParameterConfiguration instance that causes the provided source type member to be ignored.
[Pure]
public static SqlParameterConfiguration IgnoreMember(string memberName)
Parameters
memberName
stringSource type's field or property name.
Returns
- SqlParameterConfiguration
New SqlParameterConfiguration instance.
IgnoreMemberWhenNull(string, bool, int?)
Creates a new SqlParameterConfiguration instance that causes the provided source type member to potentially be ignored when its value is null.
[Pure]
public static SqlParameterConfiguration IgnoreMemberWhenNull(string memberName, bool enabled = true, int? parameterIndex = null)
Parameters
memberName
stringSource type's field or property name.
enabled
boolSpecifies whether or not null source values will be completely ignored. Equal to true by default.
parameterIndex
int?Optional 0-based index to mark the parameter as positional. Equal to null by default.
Returns
- SqlParameterConfiguration
New SqlParameterConfiguration instance.
Exceptions
- ArgumentOutOfRangeException
When
parameterIndex
is less than 0.
Positional(string, int, bool?)
Creates a new SqlParameterConfiguration instance that causes the provided source type member to be treated as a positional parameter.
[Pure]
public static SqlParameterConfiguration Positional(string memberName, int parameterIndex, bool? isIgnoredWhenNull = null)
Parameters
memberName
stringSource type's field or property name.
parameterIndex
intOptional 0-based index to mark the parameter as positional.
isIgnoredWhenNull
bool?Specifies whether or not null source values will be completely ignored. Equal to null by default.
Returns
- SqlParameterConfiguration
New SqlParameterConfiguration instance.
Exceptions
- ArgumentOutOfRangeException
When
parameterIndex
is less than 0.