Sprache

IMaterializationInterceptor.CreatingInstance Methode

Definition

Wird unmittelbar aufgerufen, bevor EF eine Instanz einer Entität erstellt. Das heißt, bevor der Konstruktor aufgerufen wurde.

public virtual Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<object> CreatingInstance(Microsoft.EntityFrameworkCore.Diagnostics.MaterializationInterceptionData materializationData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<object> result);
abstract member CreatingInstance : Microsoft.EntityFrameworkCore.Diagnostics.MaterializationInterceptionData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj>
override this.CreatingInstance : Microsoft.EntityFrameworkCore.Diagnostics.MaterializationInterceptionData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<obj>
Public Overridable Function CreatingInstance (materializationData As MaterializationInterceptionData, result As InterceptionResult(Of Object)) As InterceptionResult(Of Object)

Parameter

materializationData
MaterializationInterceptionData

Kontextbezogene Informationen über die Materialisierung.

result
InterceptionResult<Object>

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 dies der Fall ist true, unterdrückt EF die Erstellung der Entitätsinstanz und verwendet Result stattdessen. Eine Implementierung dieser Methode für jeden Interceptor, der nicht versucht, das Ergebnis zu ändern, sollte den result übergebenen Wert zurückgeben.

Gilt für: