Table of Contents

Interface IUpdateSqlGenerator

Namespace
Microsoft.EntityFrameworkCore.Update
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

A service used to generate SQL for insert, update, and delete commands, and related SQL operations needed for Microsoft.EntityFrameworkCore.DbContext.SaveChanges

This type is typically used by database providers; it is generally not used in application code.

public interface IUpdateSqlGenerator

Remarks

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.

See Implementation of database providers and extensions for more information and examples.

Methods

AppendBatchHeader(StringBuilder)

Appends a SQL fragment for the start of a batch to the full command being built by the given StringBuilder.

void AppendBatchHeader(StringBuilder commandStringBuilder)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL fragment should be appended.

AppendDeleteOperation(StringBuilder, IReadOnlyModificationCommand, int)

Appends a SQL command for deleting a row to the commands being built.

ResultSetMapping AppendDeleteOperation(StringBuilder commandStringBuilder, IReadOnlyModificationCommand command, int commandPosition)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL should be appended.

command IReadOnlyModificationCommand

The command that represents the delete operation.

commandPosition int

The ordinal of this command in the batch.

Returns

ResultSetMapping

The ResultSetMapping for the command.

AppendDeleteOperation(StringBuilder, IReadOnlyModificationCommand, int, out bool)

Appends a SQL command for deleting a row to the commands being built.

ResultSetMapping AppendDeleteOperation(StringBuilder commandStringBuilder, IReadOnlyModificationCommand command, int commandPosition, out bool requiresTransaction)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL should be appended.

command IReadOnlyModificationCommand

The command that represents the delete operation.

commandPosition int

The ordinal of this command in the batch.

requiresTransaction bool

Returns whether the SQL appended must be executed in a transaction to work correctly.

Returns

ResultSetMapping

The ResultSetMapping for the command.

AppendInsertOperation(StringBuilder, IReadOnlyModificationCommand, int)

Appends a SQL command for inserting a row to the commands being built.

ResultSetMapping AppendInsertOperation(StringBuilder commandStringBuilder, IReadOnlyModificationCommand command, int commandPosition)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL should be appended.

command IReadOnlyModificationCommand

The command that represents the delete operation.

commandPosition int

The ordinal of this command in the batch.

Returns

ResultSetMapping

The ResultSetMapping for the command.

AppendInsertOperation(StringBuilder, IReadOnlyModificationCommand, int, out bool)

Appends a SQL command for inserting a row to the commands being built.

ResultSetMapping AppendInsertOperation(StringBuilder commandStringBuilder, IReadOnlyModificationCommand command, int commandPosition, out bool requiresTransaction)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL should be appended.

command IReadOnlyModificationCommand

The command that represents the delete operation.

commandPosition int

The ordinal of this command in the batch.

requiresTransaction bool

Returns whether the SQL appended must be executed in a transaction to work correctly.

Returns

ResultSetMapping

The ResultSetMapping for the command.

AppendNextSequenceValueOperation(StringBuilder, string, string?)

Generates a SQL fragment that will query for the next value from the given sequence and appends it to the full command being built by the given StringBuilder.

void AppendNextSequenceValueOperation(StringBuilder commandStringBuilder, string name, string? schema)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL fragment should be appended.

name string

The name of the sequence.

schema string

The schema that contains the sequence, or null to use the default schema.

AppendObtainNextSequenceValueOperation(StringBuilder, string, string?)

Generates a SQL fragment that will get the next value from the given sequence and appends it to the full command being built by the given StringBuilder.

void AppendObtainNextSequenceValueOperation(StringBuilder commandStringBuilder, string name, string? schema)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL fragment should be appended.

name string

The name of the sequence.

schema string

The schema that contains the sequence, or null to use the default schema.

AppendStoredProcedureCall(StringBuilder, IReadOnlyModificationCommand, int, out bool)

Appends SQL for calling a stored procedure.

ResultSetMapping AppendStoredProcedureCall(StringBuilder commandStringBuilder, IReadOnlyModificationCommand command, int commandPosition, out bool requiresTransaction)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL should be appended.

command IReadOnlyModificationCommand

The command that represents the stored procedure call.

commandPosition int

The ordinal of this command in the batch.

requiresTransaction bool

Returns whether the SQL appended must be executed in a transaction to work correctly.

Returns

ResultSetMapping

The ResultSetMapping for the command.

AppendUpdateOperation(StringBuilder, IReadOnlyModificationCommand, int)

Appends a SQL command for updating a row to the commands being built.

ResultSetMapping AppendUpdateOperation(StringBuilder commandStringBuilder, IReadOnlyModificationCommand command, int commandPosition)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL should be appended.

command IReadOnlyModificationCommand

The command that represents the delete operation.

commandPosition int

The ordinal of this command in the batch.

Returns

ResultSetMapping

The ResultSetMapping for the command.

AppendUpdateOperation(StringBuilder, IReadOnlyModificationCommand, int, out bool)

Appends a SQL command for updating a row to the commands being built.

ResultSetMapping AppendUpdateOperation(StringBuilder commandStringBuilder, IReadOnlyModificationCommand command, int commandPosition, out bool requiresTransaction)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL should be appended.

command IReadOnlyModificationCommand

The command that represents the delete operation.

commandPosition int

The ordinal of this command in the batch.

requiresTransaction bool

Returns whether the SQL appended must be executed in a transaction to work correctly.

Returns

ResultSetMapping

The ResultSetMapping for the command.

GenerateNextSequenceValueOperation(string, string?)

Generates SQL that will query for the next value in the given sequence.

string GenerateNextSequenceValueOperation(string name, string? schema)

Parameters

name string

The name of the sequence.

schema string

The schema that contains the sequence, or null to use the default schema.

Returns

string

The SQL.

GenerateObtainNextSequenceValueOperation(string, string?)

Generates SQL that will obtain the next value in the given sequence.

string GenerateObtainNextSequenceValueOperation(string name, string? schema)

Parameters

name string

The name of the sequence.

schema string

The schema that contains the sequence, or null to use the default schema.

Returns

string

The SQL.

PrependEnsureAutocommit(StringBuilder)

Prepends a SQL command for turning on autocommit mode in the database, in case it is off.

void PrependEnsureAutocommit(StringBuilder commandStringBuilder)

Parameters

commandStringBuilder StringBuilder

The builder to which the SQL should be prepended.