Class SqlBuilderInterpolator
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
literalLengthintProvided by the compiler to optimize the size of the string builder.
formattedCountintNumber of formatted placeholders in the interpolation.
dbConnectionDbConnectionConnection used to create the underlying command.
syntaxOptionsSqlSyntaxOptionsSyntax 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
literalLengthintProvided by the compiler to optimize the size of the string builder.
formattedCountintNumber of formatted placeholders in the interpolation.
dbCommandIDbCommandCommand to modify.
syntaxOptionsSqlSyntaxOptionsSyntax 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
literalLengthintProvided by the compiler to optimize the size of the string builder.
formattedCountintNumber of formatted placeholders in the interpolation.
dbConnectionIDbConnectionConnection used to create the underlying command.
syntaxOptionsSqlSyntaxOptionsSyntax options controlling parameter prefixes.
Properties
DbCommand
Command associated with this interpolator. Parameters will be created on this command.
public IDbCommand DbCommand { get; }
Property Value
SyntaxOptions
Gets the syntax options controlling parameter names for the interpolator.
public SqlSyntaxOptions SyntaxOptions { get; }
Property Value
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
valueTThe value being interpolated.
namestringName of the argument being interpolated.
Type Parameters
TType of the value to append.
AppendLiteral(string)
Appends a literal piece of SQL to the internal buffer.
public void AppendLiteral(string s)
Parameters
sstringThe literal string to append.
ToString()
Returns the built SQL query.
public override string ToString()
Returns
- string
The SQL string accumulated so far.