Hi all,
I was wondering if there was a generic way to log changes/additions/deletions for each object using EF 4.0. I know you can override the int SaveChanges(SaveOptions options) method but i'm not sure what i should put in there.
Thanks
Hi all,
I was wondering if there was a generic way to log changes/additions/deletions for each object using EF 4.0. I know you can override the int SaveChanges(SaveOptions options) method but i'm not sure what i should put in there.
Thanks
You can handle SavingChanges event on your context and use context.ObjectStateManager.GetObjectStateEntries(EntityState) to get information about changes. This method returns enumeration of ObjectStateEntry which contains information about changes.