Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work item for entity lifecycle hooks #15858

Closed
SidShetye opened this issue May 30, 2019 · 4 comments
Closed

Work item for entity lifecycle hooks #15858

SidShetye opened this issue May 30, 2019 · 4 comments

Comments

@SidShetye
Copy link

This is a work-item issue emerging from the parent discussion issue which already captures the community demand/severity. We'd like to regain functionality that existed in EF 6 but has been missing in EF Core.

EF Core should have the following events

  1. ObjectMaterialized: An event fired when the raw data read from the database is filled into the entity object. As seen in EF 6 here.
  2. SavingChanges: An event fired when the entity object is just about to be written to the database. As seen in EF 6 here.
  3. SavedChanges: An event fired after the SavingChanges operation has completed (successfully or otherwise)
@weitzhandler
Copy link
Contributor

Would it be better to replace the events with virtual methods, such as OnObjectMaterialized<TEntity>(TEntity entity) where TEntity : class etc?

@SidShetye
Copy link
Author

@weitzhandler: Not really. See this for reasons

@ajcvickers
Copy link
Member

Split out into separate issues #15910 and #15911 as requested by @divega on #626

@JValck
Copy link

JValck commented Nov 4, 2019

For those who came here via SEO: because I needed this functionality myself, I created my own package with lifecycle hooks.

You can download it via NuGet. Full docs are available on the Github page of the project.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants