Interface ISqlGenerationHelper
- Namespace
- Microsoft.EntityFrameworkCore.Storage
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
Provides services to help with generation of SQL commands.
This type is typically used by database providers (and other extensions). It is generally not used in application code.
The service lifetime is Singleton. This means a single instance is used by many Microsoft.EntityFrameworkCore.DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.
public interface ISqlGenerationHelper
Properties
BatchTerminator
The terminator to be used for batches of SQL statements.
string BatchTerminator { get; }
Property Value
CommitTransactionStatement
Gets the SQL for a COMMIT statement.
string CommitTransactionStatement { get; }
Property Value
SingleLineCommentToken
The default single-line comment prefix.
string SingleLineCommentToken { get; }
Property Value
StartTransactionStatement
Gets the SQL for a START TRANSACTION statement.
string StartTransactionStatement { get; }
Property Value
StatementTerminator
The terminator to be used for SQL statements.
string StatementTerminator { get; }
Property Value
Methods
DelimitIdentifier(string)
Generates the delimited SQL representation of an identifier (column name, table name, etc.).
string DelimitIdentifier(string identifier)
Parameters
identifierstringThe identifier to delimit.
Returns
- string
The generated string.
DelimitIdentifier(string, string)
Generates the delimited SQL representation of an identifier (column name, table name, etc.).
string DelimitIdentifier(string name, string schema)
Parameters
Returns
- string
The generated string.
DelimitIdentifier(StringBuilder, string)
Writes the delimited SQL representation of an identifier (column name, table name, etc.).
void DelimitIdentifier(StringBuilder builder, string identifier)
Parameters
builderStringBuilderThe StringBuilder to write generated string to.
identifierstringThe identifier to delimit.
DelimitIdentifier(StringBuilder, string, string)
Writes the delimited SQL representation of an identifier (column name, table name, etc.).
void DelimitIdentifier(StringBuilder builder, string name, string schema)
Parameters
builderStringBuilderThe StringBuilder to write generated string to.
namestringThe identifier to delimit.
schemastringThe schema of the identifier.
GenerateComment(string)
Generates a SQL comment.
string GenerateComment(string text)
Parameters
textstringThe comment text.
Returns
- string
The generated SQL.
GenerateParameterName(string)
Generates a valid parameter name for the given candidate name.
string GenerateParameterName(string name)
Parameters
namestringThe candidate name for the parameter.
Returns
- string
A valid name based on the candidate name.
GenerateParameterName(StringBuilder, string)
Writes a valid parameter name for the given candidate name.
void GenerateParameterName(StringBuilder builder, string name)
Parameters
builderStringBuilderThe StringBuilder to write generated string to.
namestringThe candidate name for the parameter.
GenerateParameterNamePlaceholder(string)
Generates a valid parameter placeholder name for the given candidate name.
string GenerateParameterNamePlaceholder(string name)
Parameters
namestringThe candidate name for the parameter placeholder.
Returns
- string
A valid placeholder name based on the candidate name.
GenerateParameterNamePlaceholder(StringBuilder, string)
Writes a valid parameter placeholder name for the given candidate name.
void GenerateParameterNamePlaceholder(StringBuilder builder, string name)
Parameters
builderStringBuilderThe StringBuilder to write generated string to.
namestringThe candidate name for the parameter placeholder.