imagine we have an object have a property:
//the date which app has been added to the system
public virtual DateTime SubmitionDate { get; set; }
how can I set default value (current date) for SubmutionDate
in the sqlServer 2008 using mapping class?
I did like this but it doesn't work and raise an sqlDateTimeException!
Map(x => x.SubmitionDate).Default(System.DateTime.Now.ToString()).Not.Nullable();
The mapping is being processed only when your session factory is being created. Therefore you can't specify the date directly in mapping.
You can however specify the SQL (or rather HQL) function instead like this: