Table of Contents

Class MultiVariableHandler

Namespace
Rinku.Querying.Parameters
Assembly
Rinku.dll

The handler behind the _X marker. It spreads a collection into numbered parameters, so @Items becomes @Items_1, @Items_2, ... @Items_N, one per element, ready for an IN clause.

public class MultiVariableHandler : SpecialHandler, IQuerySegmentHandler
Inheritance
MultiVariableHandler
Implements
Inherited Members
Extension Methods

Constructors

MultiVariableHandler(string)

The handler behind the _X marker. It spreads a collection into numbered parameters, so @Items becomes @Items_1, @Items_2, ... @Items_N, one per element, ready for an IN clause.

public MultiVariableHandler(string ParameterName)

Parameters

ParameterName string

Fields

CachedParam

How each element parameter is bound.

public DbParamInfo CachedParam

Field Value

DbParamInfo

ParameterName

The base name the numbered parameters are built from.

public string ParameterName

Field Value

string

Methods

Build(string)

The factory used to register this handler under a letter in SpecialHandlerGetter.

public static MultiVariableHandler Build(string Name)

Parameters

Name string

Returns

MultiVariableHandler

CanHandle(ref object?)

Returns whether the value contains at least one item when it is a sequence.

public override bool CanHandle(ref object? value)

Parameters

value object

Returns

bool

GetUsageEmitter(Type, MemberInfo)

The part of CanHandle(ref object?) that is cheap enough to fold into the presence check a parameter object is read with, turning a key away before its value is ever fetched. This is an optimization and carries no promise, so whatever it lets through is asked of CanHandle(ref object?) in full. Returning null keeps the member on the ordinary presence check.

public override Action<ILGenerator, int>? GetUsageEmitter(Type targetType, MemberInfo member)

Parameters

targetType Type

The parameter object's type.

member MemberInfo

The member holding this handler's variable.

Returns

Action<ILGenerator, int>

Handle(ref ValueStringBuilder, object)

Writes one parameter marker for each item such as @P_1, @P_2. Pass the collection or its positive item count in value.

public override void Handle(ref ValueStringBuilder sb, object value)

Parameters

sb ValueStringBuilder
value object

ResetCache(DbParamInfo)

Returns learned provider metadata owned by this handler to the inferred strategy.

public override void ResetCache(DbParamInfo inferred)

Parameters

inferred DbParamInfo

The current inferred strategy supplied by the parameter services.

SaveUse(IDbCommand, ref object?)

Binds the collection and replaces value with an object[] to enable subsequent differential Update(IDbCommand, ref object?, object?) calls.

public override bool SaveUse(IDbCommand cmd, ref object? value)

Parameters

cmd IDbCommand
value object

Returns

bool

Update(IDbCommand, ref object?, object?)

Performs a differential update on the command. Adds, updates, or prunes parameters based on the change in collection size since the last SaveUse(IDbCommand, ref object?).

public override bool Update(IDbCommand cmd, ref object? currentValue, object? newValue)

Parameters

cmd IDbCommand
currentValue object
newValue object

Returns

bool

UpdateCache<T>(T)

Settles this handler's parameter metadata from a provider reader, so later runs bind without inferring.

public override bool UpdateCache<T>(T infoGetter) where T : IDbParamInfoGetter

Parameters

infoGetter T

Returns

bool

Type Parameters

T

Use(DbCommand, ref object?)

public override bool Use(DbCommand cmd, ref object? value)

Parameters

cmd DbCommand
value object

Returns

bool

Use(IDbCommand, ref object?)

Binds the collection for a single pass. A collection that can report its count is left in place for the render pass to count. A lazy sequence is walked only here and value becomes the int count of bound items instead.

public override bool Use(IDbCommand cmd, ref object? value)

Parameters

cmd IDbCommand
value object

Returns

bool