开发者

NHibernate - auto generate timestamp on create and update?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜