Sprache

DbConnectionInterceptor.ConnectionCreating Methode

Definition

Wird direkt aufgerufen, bevor EF eine DbConnection. Dieses Ereignis wird nicht ausgelöst, wenn die Anwendung die zu verwendende Verbindung bereitstellt.

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

Parameter

eventData
ConnectionCreatingEventData

Kontextbezogene Informationen zur Verbindung.

result
InterceptionResult<DbConnection>

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

Wenn HasResult ja false, wird EF normal fortgesetzt. Wenn HasResult ja true, wird EF den Vorgang unterdrücken, der stattdessen ausgeführt und verwendet Result werden soll. Eine Implementierung dieser Methode für jeden Interceptor, der nicht versucht, das Ergebnis zu ändern, sollte den result übergebenen Wert zurückgeben.

Implementiert

Gilt für: