Sprache

DbCommandInterceptor.CommandCreating Methode

Definition

Wird gerade vor EF aufgerufen, um den Anruf zu tätigen CreateCommand().

public virtual Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> CommandCreating(Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> result);
abstract member CommandCreating : Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand>
override this.CommandCreating : Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand>
Public Overridable Function CommandCreating (eventData As CommandCorrelatedEventData, result As InterceptionResult(Of DbCommand)) As InterceptionResult(Of DbCommand)

Parameter

eventData
CommandCorrelatedEventData

Kontextbezogene Informationen zum Befehl und zur Ausführung.

result
InterceptionResult<DbCommand>

Stellt das aktuelle Ergebnis dar, falls vorhanden. Dieser Wert muss festgelegt true werdenHasResult, wenn ein früherer Interceptor die Ausführung durch Aufrufen SuppressWithResult(TResult)unterdrückt hat. Dieser Wert wird in der Regel als Rückgabewert für die Implementierung dieser Methode verwendet.

Gibt zurück

Ist HasResult "false", wird der EF normal fortgesetzt. Wenn HasResult "true" ist, unterdrückt EF den Vorgang, den er stattdessen ausführen und verwenden Result wollte. Eine normale Implementierung dieser Methode für jeden Interceptor, der nicht versucht, das Ergebnis zu ändern, besteht darin, den result übergebenen Wert zurückzugeben.

Implementiert

Gilt für: