Table of Contents

Interface IQueryBuilder

Namespace
Rinku.Querying
Assembly
Rinku.dll

Supplies a query's values from code instead of a parameter object. You set variables and switch conditional parts on or off, then run the command from the builder. Use it when values come from branching C# logic instead of one parameter object.

public interface IQueryBuilder
Extension Methods

Remarks

A query is a set of optional pieces. Nothing is included until you ask for it. A variable is a piece that carries a value (a @name parameter). A condition is a piece that only turns on or off (a conditional marker or a projected column), it carries no data. Both are addressed by name or, once you know it, by index.

Properties

this[int]

The value set for the variable or condition at ind, or null when it is off.

object? this[int ind] { get; }

Parameters

ind int

Property Value

object

this[ReadOnlySpan<char>]

The value set for the named variable or condition, or null when it is off.

object? this[ReadOnlySpan<char> condition] { get; }

Parameters

condition ReadOnlySpan<char>

Property Value

object

this[string]

The value set for the named variable or condition, or null when it is off.

object? this[string condition] { get; }

Parameters

condition string

Property Value

object

Methods

GetQueryText()

The SQL text for the current state, with the off pieces dropped. Reads the state alone and touches no command, so you can inspect what a run would send without executing it.

string GetQueryText()

Returns

string

Remove(ReadOnlySpan<char>)

Turns off the named variable or condition so its part drops from the query.

void Remove(ReadOnlySpan<char> condition)

Parameters

condition ReadOnlySpan<char>

The variable or condition name.

Remove(string)

Turns off the named variable or condition so its part drops from the query.

void Remove(string condition)

Parameters

condition string

The variable or condition name.

Reset()

Turns everything off, back to the state of a fresh builder.

void Reset()

UnUse(int)

Turns off the condition at conditionIndex.

void UnUse(int conditionIndex)

Parameters

conditionIndex int

The condition index.

UnUse(ReadOnlySpan<char>)

Turns off a condition previously turned on with Use(string).

bool UnUse(ReadOnlySpan<char> condition)

Parameters

condition ReadOnlySpan<char>

The condition name.

Returns

bool

true if the name is a condition, false if it names a value-carrying variable instead.

UnUse(string)

Turns off a condition previously turned on with Use(string).

bool UnUse(string condition)

Parameters

condition string

The condition name.

Returns

bool

true if the name is a condition, false if it names a value-carrying variable instead.

Use(char, string, object?)

Sets a variable to value and turns it on, spelling the variable character apart from the name so the name can come from nameof.

bool Use(char charVariable, string variable, object? value)

Parameters

charVariable char

The variable character the query uses, such as @.

variable string

The variable name, without the leading character.

value object

The value to bind.

Returns

bool

true if the name is a value-carrying variable and was set.

Use(int)

Turns on the condition at conditionIndex.

void Use(int conditionIndex)

Parameters

conditionIndex int

The condition index.

Use(int, object?)

Sets the variable at variableIndex to value.

void Use(int variableIndex, object? value)

Parameters

variableIndex int

The variable index.

value object

The value to bind.

Use(ReadOnlySpan<char>)

Turns on a condition, a piece that carries no value (a conditional marker or a projected column).

bool Use(ReadOnlySpan<char> condition)

Parameters

condition ReadOnlySpan<char>

The condition name.

Returns

bool

true if the name is a condition and was turned on, false if it names a value-carrying variable instead.

Use(ReadOnlySpan<char>, object?)

Sets a variable to value and turns it on. A null value turns it off.

bool Use(ReadOnlySpan<char> variable, object? value)

Parameters

variable ReadOnlySpan<char>

The variable name.

value object

The value to bind.

Returns

bool

true if the name is a value-carrying variable and was set.

Use(string)

Turns on a condition, a piece that carries no value (a conditional marker or a projected column).

bool Use(string condition)

Parameters

condition string

The condition name.

Returns

bool

true if the name is a condition and was turned on, false if it names a value-carrying variable instead.

Use(string, object?)

Sets a variable to value and turns it on. A null value turns it off.

bool Use(string variable, object? value)

Parameters

variable string

The variable name.

value object

The value to bind.

Returns

bool

true if the name is a value-carrying variable and was set.

UseWith(object)

Copies usable values from a parameter object into the builder.

void UseWith(object parameterObject)

Parameters

parameterObject object

UseWith<T>(T)

Copies usable values from a parameter object into the builder.

void UseWith<T>(T parameterObject) where T : notnull

Parameters

parameterObject T

Type Parameters

T

UseWith<T>(ref T)

Copies usable values from a parameter object into the builder.

void UseWith<T>(ref T parameterObject) where T : notnull

Parameters

parameterObject T

Type Parameters

T