Many times our projects require to keep some kind of auditing on database rows for changes and updates, so we can know who and when created a row or did the last update to it.
When we have lots of entities and mappings going up and down through our application layers, sometimes is difficult to know where and how we have to handle this task.
In this article, I’ll show you a good technique to implement database row auditing using Entity Framework. Maybe you’ll find another approaches you might consider better, but this is a clean and single method one, and it’s the one I use in my own projects at work.
For the demonstration, I’m gonna use as base the project I created for my previous article “Entity Framework 6.0 code first & TPT, persistence of polymorphic collections“. (You did read it, didn’t you?).
Clone the repository: https://firstname.lastname@example.org/joanvilarino/entityframework_tpt.git
Download Zip file: https://bitbucket.org/joanvilarino/entityframework_tpt/downloads