Struct MaterializationInterceptionData
- Namespace
- Microsoft.EntityFrameworkCore.Diagnostics
- Assembly
- Microsoft.EntityFrameworkCore.dll
A parameter object passed to IMaterializationInterceptor methods containing data about the instance being materialized.
public readonly struct MaterializationInterceptionData
- Inherited Members
Remarks
See Logging, events, and diagnostics for more information and examples.
Constructors
MaterializationInterceptionData(MaterializationContext, IEntityType, QueryTrackingBehavior?, Dictionary<IPropertyBase, (object TypedAccessor, Func<MaterializationContext, object?> Accessor)>)
This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.
[EntityFrameworkInternal]
public MaterializationInterceptionData(MaterializationContext materializationContext, IEntityType entityType, QueryTrackingBehavior? queryTrackingBehavior, Dictionary<IPropertyBase, (object TypedAccessor, Func<MaterializationContext, object?> Accessor)> valueAccessor)
Parameters
materializationContext
MaterializationContextentityType
IEntityTypequeryTrackingBehavior
QueryTrackingBehavior?valueAccessor
Dictionary<IPropertyBase, (object TypedAccessor, Func<MaterializationContext, object> Accessor)>
Properties
Context
The current DbContext instance being used.
public DbContext Context { get; }
Property Value
EntityType
The type of the entity being materialized.
public IEntityType EntityType { get; }
Property Value
QueryTrackingBehavior
The query tracking behavior, or null if this materialization is not from a query.
public QueryTrackingBehavior? QueryTrackingBehavior { get; }
Property Value
Methods
GetPropertyValue(IPropertyBase)
Gets the property value for the given property.
public object? GetPropertyValue(IPropertyBase property)
Parameters
property
IPropertyBaseThe property.
Returns
- object
The property value.
Remarks
This non-generic overload of this method will always cause a primitive or value-type property value to be boxed into a heap-allocated object.
GetPropertyValue(string)
Gets the property value for the property with the given name.
public object? GetPropertyValue(string propertyName)
Parameters
propertyName
stringThe property name.
Returns
- object
The property value.
Remarks
This non-generic overload of this method will always cause a primitive or value-type property value to be boxed into a heap-allocated object.
GetPropertyValue<T>(IPropertyBase)
Gets the property value for the given property.
public T GetPropertyValue<T>(IPropertyBase property)
Parameters
property
IPropertyBaseThe property.
Returns
- T
The property value.
Type Parameters
T
Remarks
This generic overload of this method will not cause a primitive or value-type property value to be boxed into a heap-allocated object.
GetPropertyValue<T>(string)
Gets the property value for the property with the given name.
public T GetPropertyValue<T>(string propertyName)
Parameters
propertyName
stringThe property name.
Returns
- T
The property value.
Type Parameters
T
Remarks
This generic overload of this method will not cause a primitive or value-type property value to be boxed into a heap-allocated object.