We need to implement a comprehensive audit log of changes for an aggregate entity called Project, where users can see what changed with each save and the before and after values of those changes. The entity contains a few child collections (for example a collection of TeamMember entities).
There are options like EF Plus (http://entityframework-plus.net/) which manages the audit for you or we could override EFs savechanges() and write to our own audit table manually.
Where things get tricky are where you have a navigation property. Any child collections such as TeamMembers are seen as a separate entry in the change tracker and therefore would be logged as an update independently of project. We need to be able to track all changes for a specific project i.e. anything that has changed within that object graph.
Having searched quite exhaustively online, we are at a bit of loss as to what to try. The option we are looking at now is serialising into JSON the whole Project entity, prior to and after save, into an audit log. We then need to write some custom comparison logic to see whats changed and return that to the UI. This seems like unnecessary complexity.
If anyone in the community has done this before and has a good approach or any ideas here it would be of great help.