Skip to content

Implement entity materialization interception#28274

Merged
ajcvickers merged 2 commits intomainfrom
AnObjectInTheHandIsWorthTwoInTheBush0616
Jun 20, 2022
Merged

Implement entity materialization interception#28274
ajcvickers merged 2 commits intomainfrom
AnObjectInTheHandIsWorthTwoInTheBush0616

Conversation

@ajcvickers
Copy link
Contributor

Part of #626
Fixes #15911

Introduces a new IMaterializationInterceptor singleton interceptor that allows:

  • Interception before any entity instance has been created, allowing a customized instance to be created (if desired), thereby suppressing of normal EF instance creation.
  • Interception after the instance has been created, but before property values have been set. The instance can be replaced with a new instance (if desired), without preventing EF from setting property values.
  • Interception before property values have been set, allowing custom setting of the values and/or suppression of setting the values by EF (if desired).
  • Interception after property values have been set, allowing the instance to be changed (if desired.)

Access to property values, including shadow and service properties is provided at each point.

If no singleton materialization interceptors are configured, then the materialization delegate is the same as before, meaning any perf impact only applies if interception is used.

@ajcvickers ajcvickers requested a review from a team June 20, 2022 09:39
Part of #626
Fixes #15911

Introduces a new `IMaterializationInterceptor` singleton interceptor that allows:
- Interception before any entity instance has been created, allowing a customized instance to be created (if desired), thereby suppressing of normal EF instance creation.
- Interception after the instance has been created, but before property values have been set. The instance can be replaced with a new instance (if desired), without preventing EF from setting property values.
- Interception before property values have been set, allowing custom setting of the values and/or suppression of setting the values by EF (if desired).
- Interception after property values have been set, allowing the instance to be changed (if desired.)

Access to property values, including shadow and service properties is provided at each point.

If no singleton materialization interceptors are configured, then the materialization delegate is the same as before, meaning any perf impact only applies if interception is used.
@ajcvickers ajcvickers force-pushed the AnObjectInTheHandIsWorthTwoInTheBush0616 branch from 44c46ef to 0b4ccc9 Compare June 20, 2022 20:10
@ajcvickers ajcvickers merged commit 5ff4696 into main Jun 20, 2022
@ajcvickers ajcvickers deleted the AnObjectInTheHandIsWorthTwoInTheBush0616 branch June 20, 2022 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interception for object materialization (a.k.a. "ObjectMaterialized")

2 participants