Table of Contents

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

string

CommitTransactionStatement

Gets the SQL for a COMMIT statement.

string CommitTransactionStatement { get; }

Property Value

string

SingleLineCommentToken

The default single-line comment prefix.

string SingleLineCommentToken { get; }

Property Value

string

StartTransactionStatement

Gets the SQL for a START TRANSACTION statement.

string StartTransactionStatement { get; }

Property Value

string

StatementTerminator

The terminator to be used for SQL statements.

string StatementTerminator { get; }

Property Value

string

Methods

DelimitIdentifier(string)

Generates the delimited SQL representation of an identifier (column name, table name, etc.).

string DelimitIdentifier(string identifier)

Parameters

identifier string

The 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

name string

The identifier to delimit.

schema string

The schema of the identifier.

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

builder StringBuilder

The StringBuilder to write generated string to.

identifier string

The 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

builder StringBuilder

The StringBuilder to write generated string to.

name string

The identifier to delimit.

schema string

The schema of the identifier.

GenerateComment(string)

Generates a SQL comment.

string GenerateComment(string text)

Parameters

text string

The comment text.

Returns

string

The generated SQL.

GenerateParameterName(string)

Generates a valid parameter name for the given candidate name.

string GenerateParameterName(string name)

Parameters

name string

The 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

builder StringBuilder

The StringBuilder to write generated string to.

name string

The candidate name for the parameter.

GenerateParameterNamePlaceholder(string)

Generates a valid parameter placeholder name for the given candidate name.

string GenerateParameterNamePlaceholder(string name)

Parameters

name string

The 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

builder StringBuilder

The StringBuilder to write generated string to.

name string

The candidate name for the parameter placeholder.