skip to Main Content
[NHibernate] Update Your Time Stamp Automaticaly

[NHibernate] Update your time stamp automaticaly

I was writing lately about problem with a lack of precision in date. I said about having many tables with column with time stamp of last update. You can figure it about that changing it by hand is very painful.

You can automatize that by using Listener. Listener – ekm – listen for changes that are sent to database. You can define Listner like that

Entity have property of type DateTime and name of LastChange. Those entities implements interface ILastChange, which requires to implement property of name LastChange.

For NHibernate to start using Listener it must be registered to use when you create SessionFactory. If you use an Fluent NHibernate registration should like this:


Back To Top