Class SqlBuilder

Namespace: redb.Route.Sql
Assembly: redb.Route.Sql.dll

Fluent builder for SQL endpoint URIs. Thin sugar over .
Call or use implicit conversion to
to get the URI for From() / To().

public sealed class SqlBuilder

Inheritance

Object→SqlBuilder

Methods

AsFunction()

Calls as a function instead of a procedure.

public SqlBuilder AsFunction()

BackslashEscapes()

Reads a backslash inside '…' and "…" as an escape, as MySQL and MariaDB do by default — see

public SqlBuilder BackslashEscapes()

Batch(IExpression)

Sets the batch size from an expression. Only constant expressions and {{property}} placeholders are accepted:

public SqlBuilder Batch(IExpression size)

Batch(int)

Enables batch mode for producer mode: a list body is written item by item in one transaction.

public SqlBuilder Batch(int size)

BreakBatchOnError()

Stops the batch on the first error and rolls it back (the default).

public SqlBuilder BreakBatchOnError()

BreakBatchOnError(bool)

Chooses what a failing batch item does: true stops and rolls the batch back (the default); false undoes

public SqlBuilder BreakBatchOnError(bool enabled)

Build()

Builds the URI string for use in From() / To().

public string Build()

CommandTimeout(IExpression)

Sets the command timeout from an expression.

public SqlBuilder CommandTimeout(IExpression seconds)

CommandTimeout(int)

Sets the command timeout in seconds.

public SqlBuilder CommandTimeout(int seconds)

ConnectionString(IExpression)

Sets a direct connection string from a constant expression; a ${...} expression is refused, as for .

public SqlBuilder ConnectionString(IExpression cs)

ConnectionString(string)

Sets a direct connection string.

public SqlBuilder ConnectionString(string cs)

DataSource(IExpression)

Sets the named data source from a constant expression. The data source is fixed when the endpoint is created: a

public SqlBuilder DataSource(IExpression name)

DataSource(string)

Sets the named data source (constant name, e.g. "main").

public SqlBuilder DataSource(string name)

Delay(IExpression)

Sets the delay from an expression.

public SqlBuilder Delay(IExpression ms)

Delay(int)

Sets the delay between polls in milliseconds.

public SqlBuilder Delay(int ms)

FixedRate()

Enables fixed-rate polling.

public SqlBuilder FixedRate()

In(string, DbType, string)

Adds an IN parameter with an expression value.

public SqlBuilder In(string name, DbType type, string expression)

In(string, DbType)

Adds an IN parameter definition.

public SqlBuilder In(string name, DbType type)

InitialDelay(IExpression)

Sets the initial delay from an expression.

public SqlBuilder InitialDelay(IExpression ms)

InitialDelay(int)

Sets the initial delay before the first poll.

public SqlBuilder InitialDelay(int ms)

InOut(string, DbType)

Adds an INOUT parameter definition.

public SqlBuilder InOut(string name, DbType type)

MaxMessagesPerPoll(IExpression)

Sets max messages per poll from an expression.

public SqlBuilder MaxMessagesPerPoll(IExpression max)

MaxMessagesPerPoll(int)

Sets the maximum rows per poll.

public SqlBuilder MaxMessagesPerPoll(int max)

Noop()

Enables dry-run mode.

public SqlBuilder Noop()

OnBatchComplete(string)

SQL to execute after the entire batch.

public SqlBuilder OnBatchComplete(string sql)

OnFailure(string)

SQL to execute when processing a row fails.

public SqlBuilder OnFailure(string sql)

OnSuccess(string)

SQL to execute after each row is successfully processed.

public SqlBuilder OnSuccess(string sql)

Out(string, DbType)

Adds an OUT parameter definition.

public SqlBuilder Out(string name, DbType type)

OutputClass(string)

Sets the POCO type name for result mapping.

public SqlBuilder OutputClass(string typeName)

OutputHeader(IExpression)

Sends the result to a header instead of the body.

public SqlBuilder OutputHeader(IExpression headerName)

OutputType(SqlOutputType)

Sets how query results are mapped.

public SqlBuilder OutputType(SqlOutputType type)

Param(string, IExpression)

Binds a SQL parameter to an expression, resolved at runtime.

public SqlBuilder Param(string name, IExpression expression)

Param(string, object?)

Binds a SQL parameter to an explicit value, overriding auto-bind from headers/body.

public SqlBuilder Param(string name, object? value)

PlaceholderStyle(SqlPlaceholderStyle)

How :#name placeholders are written for the provider: (the default), :name (Oracle) or

public SqlBuilder PlaceholderStyle(SqlPlaceholderStyle style)

PollDelivery(SqlPollDelivery)

How polled rows reach the route: an exchange per row (the default) or one exchange with every row

public SqlBuilder PollDelivery(SqlPollDelivery delivery)

Provider(string)

Sets the ADO.NET provider name.

public SqlBuilder Provider(string name)

ReadOnly()

Runs the statement on the data source's read replica. Declare it only for a statement that does not write; a batch, and a

public SqlBuilder ReadOnly()

RepeatCount(IExpression)

Sets the repeat count from an expression.

public SqlBuilder RepeatCount(IExpression count)

RepeatCount(long)

Sets the maximum number of poll cycles.

public SqlBuilder RepeatCount(long count)

RouteEmptyResultSet()

Creates an Exchange even on empty result.

public SqlBuilder RouteEmptyResultSet()

SendEmptyMessageWhenIdle()

Sends idle notification when nothing to poll.

public SqlBuilder SendEmptyMessageWhenIdle()

ToString()

Returns a string that represents the current object.

public override string ToString()

Transacted()

Enables transaction wrapping.

public SqlBuilder Transacted()

WithIsolationLevel(IsolationLevel)

Sets the transaction isolation level.

public SqlBuilder WithIsolationLevel(IsolationLevel level)