Table of Contents

Struct SqlCommandFactory.CommandInterpolator

Namespace
Utils.Data
Assembly
Utils.Data.dll

Interpolated string handler that builds SQL commands using the factory's syntax options.

public ref struct SqlCommandFactory.CommandInterpolator
Inherited Members

Constructors

CommandInterpolator(int, int, SqlCommandFactory, DbConnection)

Initializes a new instance of the SqlCommandFactory.CommandInterpolator struct.

public CommandInterpolator(int literalLength, int formattedCount, SqlCommandFactory factory, DbConnection dbConnection)

Parameters

literalLength int

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

formattedCount int

Number of formatted placeholders in the interpolation.

factory SqlCommandFactory

Factory providing the syntax options to apply.

dbConnection DbConnection

Connection used to create the underlying command.

CommandInterpolator(int, int, SqlCommandFactory, IDbConnection)

Initializes a new instance of the SqlCommandFactory.CommandInterpolator struct.

public CommandInterpolator(int literalLength, int formattedCount, SqlCommandFactory factory, IDbConnection dbConnection)

Parameters

literalLength int

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

formattedCount int

Number of formatted placeholders in the interpolation.

factory SqlCommandFactory

Factory providing the syntax options to apply.

dbConnection IDbConnection

Connection used to create the underlying command.

Properties

DbCommand

Gets the command associated with the interpolated builder.

public IDbCommand DbCommand { get; }

Property Value

IDbCommand

SyntaxOptions

Gets the syntax options applied by 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.