Entity Framework after save event

Viewed 1733

Is there a SaveChanges event that fires after changes are saved, but before the change tracker is updated?

I am using EF 6.

I need to perform a task whenever the status changes on a certain entity.

I have overridden SaveChanges to set this up. I can use ChangeTracker to tell what changes. When it's the correct entity with the correct change I fire of my code.

After the base SaveChanges is called, ChangeTracker no longer shows the entity as modified, so I need to do my task just before I save. However, there is a chance that SaveChanges will fail and I should not have done my task.

How can I hook into the ChangeTracker after the save, but before the model and ChangeTracker is updated?

1 Answers
Related