Is there a good way to detect when the ObjectContext
changes are actually committed?
SavingChanges
occurs before going to the data store but I also need a way to know if those changes where actually committed.
Thanks in advance John
Update:
What I have is a code first DbContext. This is fed into dynamic data which as I discovered uses the DbContext's internal ObjectContext (to which I have access when casting to IObjectContextAdapter). The dbcontext's SaveChanges is not called, the objectcontext's SaveChanges is used instead. All I want to do is to be notified after the save is complete (i.e. event SavedChanges) so I can invalidate my cache.
There is no build-in event to handle this but you can override SaveChanges
method in your derived context and fire any custom event specific to your own context type after you call base.SaveChanges
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With