Using NHibernate, what is the best way to handle InsertDate (a.k.a CreateDate) and UpdateDate columns?
For example:
public class Customer
{
public virtual string Name { get; set; }
public virtual DateTime InsertDate { get; set; }
public virtual DateTime UpdateDate { get; set; }
}
There are probably multiple ways that this could be handle, but could someone who has done this before provide me with some advice.
If it's not obvious, I want InsertDate to be set to the date that a record was inserted and after that to be immutable. UpdateDate needs to be changed every time a record is updated.
Bonus marks if you answer using Fluent Nhibernate.