Reputation: 13
This is the error that I've been getting when I try to run this code:
Icriteria critBKCP = sess.CreateCriteria(typeof(BklCustomerProduct));
IList<BklCustomerProduct> objBklCustomerProducts = critBKCP.List<BklCustomerProduct>();
Debugging I found that this exception was thrown here (in the set part):
public virtual DateTime? Datemodif
{
get { return m_datemodif; }
set
{
m_datemodif = value.Value;
}
}
My mapping for that part is the following:
<property column="datemodif" type="DateTime" name="Datemodif" />
I would be really grateful if someone could help me out.
Upvotes: 0
Views: 2678
Reputation: 56964
You are defining that the type is a datetime in Your mapping. However, the type is a nullable datetime. Omit the type specification in Your mapping Definition. Nhibernate can find It out himself.
Upvotes: 1
Reputation: 2857
Try this in your mapping:
<property column="datemodif" type="System.Nullable`1[[System.DateTime, mscorlib]], mscorlib" name="Datemodif" />
Upvotes: 1