nhibernate/nhibernate-core — pull request #284 by wgroeneveld (2014-08-01 11:19:42+00:00)
Title: NH-3648 addition of entity listener annotations

See https://nhibernate.jira.com/browse/NH-3648
This is the implementation of [PreInsert], [PreUpdate], ... attributes you can place on entities which get automatically triggered through a NHibernate event listener and some reflection. It's missing from NH and the java version has this feature for years (@PrePersist, @PreUpdate). This enables developers to leverage the power of DDD instead of writing logic in data access layers.

The most common usage for this would be auto-updating audit fields (user create, timestamping).
Please let me know if it's sufficient or something is missing, I'm willing to make changes :-) I implemented a caching mechanism to speed up the reflection part - as entity type metadata simply cannot change during runtime.