Using NHibernate, what is the best way to handle InsertDate (aka CreateDate) and UpdateDate columns?
For instance:
public class Customer { public virtual string Name { get; set; } public virtual DateTime InsertDate { get; set; } public virtual DateTime UpdateDate { get; set; } }
There are probably several ways this can be handled, but maybe someone who has done this before giving me some advice.
If this is not obvious, I want InsertDate to be set to the date the record was inserted, and after that to be unchanged. UpdateDate needs to be changed every time a record is updated.
Bonus points if you respond using Fluent Nhibernate.
source share