IMaterializationInterceptor.InitializingInstance Method

Definition

Called immediately before EF is going to set property values of an entity that has just been created. Note that property values set by the constructor will already have been set.

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

Parameters

materializationData
MaterializationInterceptionData

Contextual information about the materialization happening.

entity
Object

The entity instance for which property values will be set.

result
InterceptionResult

Represents the current result if one exists. This value will have IsSuppressed set to true if some previous interceptor suppressed execution by calling Suppress(). This value is typically used as the return value for the implementation of this method.

Returns

If IsSuppressed is false, then EF will continue as normal. If IsSuppressed is true, then EF will not set any property values. An implementation of this method for any interceptor that is not attempting to suppress setting property values must return the result value passed in.

Applies to