I have certain entities that have audit trail elements like LastUpdated and LastUpdatedBy. I am looking to determine the most appropriate way to effect an update of these fields to the current date and time and current user when a model is changed.
The simplest implementation would be to affect this change in my controller before I update the objectcontext but this would result in lots of repeated code. I could refactor this a bit and possibly create a helper method that I could call and pass the model too thus reducing things to a single line of code in my controller but I honestly would rather this be automatic, something the controller code didnt have to worry about.
Has anyone approached this problem before? What was your solution? What do you suggest?
(ps mvc and ef noob so there might be a framework type option I am missing)