Table of Contents

Class SqlBuilderInterpolator

Namespace
Utils.Data
Assembly
Utils.Data.dll

Interpolated string handler used to build parameterized SQL statements.

public class SqlBuilderInterpolator
Inheritance
SqlBuilderInterpolator
Inherited Members
Extension Methods

Constructors

SqlBuilderInterpolator(int, int, DbConnection, SqlSyntaxOptions?)

Initializes a new instance of the SqlBuilderInterpolator class.

public SqlBuilderInterpolator(int literalLength, int formattedCount, DbConnection dbConnection, SqlSyntaxOptions? syntaxOptions = null)

Parameters

literalLength int

Provided by the compiler to optimize the size of the string builder.

formattedCount int

Number of formatted placeholders in the interpolation.

dbConnection DbConnection

Connection used to create the underlying command.

syntaxOptions SqlSyntaxOptions

Syntax options controlling parameter prefixes.

SqlBuilderInterpolator(int, int, IDbCommand, SqlSyntaxOptions?)

Initializes a new instance of the SqlBuilderInterpolator class.

public SqlBuilderInterpolator(int literalLength, int formattedCount, IDbCommand dbCommand, SqlSyntaxOptions? syntaxOptions = null)

Parameters

literalLength int

Provided by the compiler to optimize the size of the string builder.

formattedCount int

Number of formatted placeholders in the interpolation.

dbCommand IDbCommand

Command to modify.

syntaxOptions SqlSyntaxOptions

Syntax options controlling parameter prefixes.

SqlBuilderInterpolator(int, int, IDbConnection, SqlSyntaxOptions?)

Initializes a new instance of the SqlBuilderInterpolator class.

public SqlBuilderInterpolator(int literalLength, int formattedCount, IDbConnection dbConnection, SqlSyntaxOptions? syntaxOptions = null)

Parameters

literalLength int

Provided by the compiler to optimize the size of the string builder.

formattedCount int

Number of formatted placeholders in the interpolation.

dbConnection IDbConnection

Connection used to create the underlying command.

syntaxOptions SqlSyntaxOptions

Syntax options controlling parameter prefixes.

Properties

DbCommand

Command associated with this interpolator. Parameters will be created on this command.

public IDbCommand DbCommand { get; }

Property Value

IDbCommand

SyntaxOptions

Gets the syntax options controlling parameter names for the interpolator.

public SqlSyntaxOptions SyntaxOptions { get; }

Property Value

SqlSyntaxOptions

Methods

AppendFormatted<T>(T, string?)

Adds a formatted value to the SQL query and ensures a parameter is created.

public void AppendFormatted<T>(T value, string? name = null)

Parameters

value T

The value being interpolated.

name string

Name of the argument being interpolated.

Type Parameters

T

Type of the value to append.

AppendLiteral(string)

Appends a literal piece of SQL to the internal buffer.

public void AppendLiteral(string s)

Parameters

s string

The literal string to append.

ToString()

Returns the built SQL query.

public override string ToString()

Returns

string

The SQL string accumulated so far.