IIdentityResolutionInterceptor Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Allows interception of identity resolution conflicts when the DbContext starts tracking new entity instances.
public interface IIdentityResolutionInterceptor : Microsoft.EntityFrameworkCore.Diagnostics.IInterceptor
type IIdentityResolutionInterceptor = interface
interface IInterceptor
Public Interface IIdentityResolutionInterceptor
Implements IInterceptor
- Derived
- Implements
Remarks
A DbContext can only track one entity instance with any given primary key value. This means multiple instances of an entity with the same key value must be resolved to a single instance. An interceptor of this type can be used to do this. It is called with the existing tracked instance and the new instance and must apply any property values and relationship changes from the new instance into the existing instance. The new instance is then discarded.
Use AddInterceptors(IInterceptor[]) to register application interceptors.
Extensions can also register interceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the order that they are resolved from the service provider, and then the application interceptors are run last.
See EF Core interceptors and EF Core change tracking for more information and examples.
Methods
UpdateTrackedInstance(IdentityResolutionInterceptionData, EntityEntry, Object) |
Called when a DbContext attempts to track a new instance of an entity with the same primary key value as an already tracked instance. This method must apply any property values and relationship changes from the new instance into the existing instance. The new instance is then discarded. |
Applies to
Entity Framework