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
targetParameterNamestringName of the SQL parameter.
memberNamestringSource type's field or property name.
isIgnoredWhenNullbool?Specifies whether or not null source values will be completely ignored. Equal to null by default.
parameterIndexint?Optional 0-based index to mark the parameter as positional.
Returns
- SqlParameterConfiguration
 New SqlParameterConfiguration instance.
Exceptions
- ArgumentOutOfRangeException
 When
parameterIndexis 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
targetParameterNamestringName of the SQL parameter.
selectorExpression<Func<TSource, TValue>>Custom source value selector expression.
isIgnoredWhenNullbool?Specifies whether or not null source values will be completely ignored. Equal to null by default.
parameterIndexint?Optional 0-based index to mark the parameter as positional.
Returns
- SqlParameterConfiguration
 New SqlParameterConfiguration instance.
Type Parameters
TSourceParameter source type.
TValueSQL parameter value type.
Exceptions
- ArgumentOutOfRangeException
 When
parameterIndexis 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
memberNamestringSource 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
memberNamestringSource type's field or property name.
enabledboolSpecifies whether or not null source values will be completely ignored. Equal to true by default.
parameterIndexint?Optional 0-based index to mark the parameter as positional. Equal to null by default.
Returns
- SqlParameterConfiguration
 New SqlParameterConfiguration instance.
Exceptions
- ArgumentOutOfRangeException
 When
parameterIndexis 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
memberNamestringSource type's field or property name.
parameterIndexintOptional 0-based index to mark the parameter as positional.
isIgnoredWhenNullbool?Specifies whether or not null source values will be completely ignored. Equal to null by default.
Returns
- SqlParameterConfiguration
 New SqlParameterConfiguration instance.
Exceptions
- ArgumentOutOfRangeException
 When
parameterIndexis less than 0.