daelmo wrote:
Yes, there's a better way: Auditing.
You could download the Auditing example at example's download section.
You could write an Auditor that should be injected to all your IEntity(s) objects, so every time you entities would be saved (insert/update) the field DateModified will be updated.
OK I have an auditor that calls:
entity.SetNewFieldValue("DateModified", DateTime.UtcNow);
but the database doesn't seem to pick up the change, even though the field is updated in the object. Is there something I need to call to tell the persistence code that this field has been changed when doing this from an Auditor? The doc on the function says pretty clearly that it sets the field dirty.
Also I'm having a bit of trouble getting the dependency injection to work, either in auto mode or manual mode, but that's a different thread.