Struct SqlCommandFactory.CommandInterpolator
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
literalLengthintProvided by the compiler to optimize the size of the string builder.
formattedCountintNumber of formatted placeholders in the interpolation.
factorySqlCommandFactoryFactory providing the syntax options to apply.
dbConnectionDbConnectionConnection 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
literalLengthintProvided by the compiler to optimize the size of the string builder.
formattedCountintNumber of formatted placeholders in the interpolation.
factorySqlCommandFactoryFactory providing the syntax options to apply.
dbConnectionIDbConnectionConnection used to create the underlying command.
Properties
DbCommand
Gets the command associated with the interpolated builder.
public IDbCommand DbCommand { get; }
Property Value
SyntaxOptions
Gets the syntax options applied by 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.