Met a problem with NHibernate and enums. I have a simple entity with enumType property:
public virtual SchemaStatus Status
{
get;
set;
}
public enum SchemaStatus
{
PREP,
BGN,
FAIL,
CREA
}
And there is a mapping:
Map(x => x.Status)
.Column("Status")
.Nullable();
And what happens when status column in db table is null? NHibernate returns first value from enum, its PREP here. So my question is how to prevent nhibernate from returning first enum value instead of null when property is of enum type?