Class RelationalSqlGenerationHelper
- 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 class RelationalSqlGenerationHelper : ISqlGenerationHelper
- Inheritance
-
RelationalSqlGenerationHelper
- Implements
- Inherited Members
Constructors
RelationalSqlGenerationHelper(RelationalSqlGenerationHelperDependencies)
Initializes a new instance of the this class.
public RelationalSqlGenerationHelper(RelationalSqlGenerationHelperDependencies dependencies)
Parameters
dependencies
RelationalSqlGenerationHelperDependenciesParameter object containing dependencies for this service.
Properties
BatchTerminator
The terminator to be used for batches of SQL statements.
public virtual string BatchTerminator { get; }
Property Value
CommitTransactionStatement
public virtual string CommitTransactionStatement { get; }
Property Value
SingleLineCommentToken
The default single-line comment prefix.
public virtual string SingleLineCommentToken { get; }
Property Value
StartTransactionStatement
public virtual string StartTransactionStatement { get; }
Property Value
StatementTerminator
The terminator to be used for SQL statements.
public virtual string StatementTerminator { get; }
Property Value
Methods
DelimitIdentifier(string)
Generates the delimited SQL representation of an identifier (column name, table name, etc.).
public virtual string DelimitIdentifier(string identifier)
Parameters
identifier
stringThe identifier to delimit.
Returns
- string
The generated string.
DelimitIdentifier(string, string)
Generates the delimited SQL representation of an identifier (column name, table name, etc.).
public virtual 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.).
public virtual void DelimitIdentifier(StringBuilder builder, string identifier)
Parameters
builder
StringBuilderThe StringBuilder to write generated string to.
identifier
stringThe identifier to delimit.
DelimitIdentifier(StringBuilder, string, string)
Writes the delimited SQL representation of an identifier (column name, table name, etc.).
public virtual void DelimitIdentifier(StringBuilder builder, string name, string schema)
Parameters
builder
StringBuilderThe StringBuilder to write generated string to.
name
stringThe identifier to delimit.
schema
stringThe schema of the identifier.
EscapeIdentifier(string)
Generates the escaped SQL representation of an identifier (column name, table name, etc.).
public virtual string EscapeIdentifier(string identifier)
Parameters
identifier
stringThe identifier to be escaped.
Returns
- string
The generated string.
EscapeIdentifier(StringBuilder, string)
Writes the escaped SQL representation of an identifier (column name, table name, etc.).
public virtual void EscapeIdentifier(StringBuilder builder, string identifier)
Parameters
builder
StringBuilderThe StringBuilder to write generated string to.
identifier
stringThe identifier to be escaped.
GenerateComment(string)
Generates a SQL comment.
public virtual string GenerateComment(string text)
Parameters
text
stringThe comment text.
Returns
- string
The generated SQL.
GenerateParameterName(string)
Generates a valid parameter name for the given candidate name.
public virtual string GenerateParameterName(string name)
Parameters
name
stringThe 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.
public virtual void GenerateParameterName(StringBuilder builder, string name)
Parameters
builder
StringBuilderThe StringBuilder to write generated string to.
name
stringThe candidate name for the parameter.
GenerateParameterNamePlaceholder(string)
Generates a valid parameter placeholder name for the given candidate name.
public virtual string GenerateParameterNamePlaceholder(string name)
Parameters
name
stringThe candidate name for the parameter placeholder.
Returns
- string
A valid name based on the candidate name.
GenerateParameterNamePlaceholder(StringBuilder, string)
Writes a valid parameter placeholder name for the given candidate name.
public virtual void GenerateParameterNamePlaceholder(StringBuilder builder, string name)
Parameters
builder
StringBuilderThe StringBuilder to write generated string to.
name
stringThe candidate name for the parameter placeholder.