For example:
public class Customer
{
public virtual string Name {get; set; }
public virtual DateTime InsertDate {get; set; }
public virtual DateTime UpdateDate {get; set; }
}
There may be multiple ways to solve this problem, but before People who have done this may give me some suggestions.
If it is not obvious, I would like to set InsertDate to the date when the record was inserted, and then set it to immutable. It is required every time the record is updated Change UpdateDate.
If you use Fluent Nhibernate to answer, you can get rewards.
Using NHibernate, what is the best way to handle InsertDate (aka 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 may be multiple ways to solve this problem, but before People who have done this may give me some suggestions.
If it is not obvious, I would like to set InsertDate to the date when the record was inserted, and then set it to immutable. It is required every time the record is updated Change UpdateDate.
If you use Fluent Nhibernate to answer, you can get rewards.
Use an audit interceptor for this. A good one Examples can be found here.