I am trying to map an entity in NHibernate, that should have an 开发者_运维问答Updated column. This should be the DateTime when the entity was last written to the database (either created or updated). I'd like NHibernate to control the update of the column, so I don't need to remember to set a property to the current time before updating.
Is there a built-in feature in NHibernate, that can handle this for me ?
Use a Listener that implements IPreUpdateEventListener and IPreInsertEventListener. This article explains how. Note that this uses the user's time and that may not be appropriate for your application.
精彩评论