Share via


IMaterializationInterceptor.CreatingInstance Method

Definition

Called immediately before EF is going to create an instance of an entity. That is, before the constructor has been called.

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)

Parameters

materializationData
MaterializationInterceptionData

Contextual information about the materialization happening.

result
InterceptionResult<Object>

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

Returns

If HasResult is false, then EF will continue as normal. If HasResult is true, then EF will suppress creation of the entity instance and use Result instead. An implementation of this method for any interceptor that is not attempting to change the result should return the result value passed in.

Applies to