Inspecting Database Changes in Entity Framework

In the event that you need to perform additional manipulation on data with Entity Framework upon save, the SaveChanges method needs to be overridden. The easiest way to go about this is to create a partial class of your ObjectContext class.

In the changedEntries collection below, each ObjectStateEntry in the collection contains an Entity property, which gives you access to the entity being added, deleted or modified for further inspection.