I have a nullable float column in a sql table which is mapped in Nhibernate. The property for this table class is defined:
public virtual float? floatColumn { get; set; }
I have another class which has
public float? anotherFloatPrprty { get; set; }
I get this error
The type System.Double can not be assigned to a property of type System.Nullable`1[System.Single] setter of MyProject
with the following session query
var j = session.CreateSQLQuery("SELECT floatColumn As anotherFloatPrprty from myTable")
So I changed the table to have that column as not null, But I still get the following error.
{"Object of type 'System.Double' cannot be converted to type 'System.Single'."}
Obviously when I don't have any value in floatColumn, I don't get any exceptions, but as soon as some values are inserted to the table (ranging from 0.01 to 1), I get these exceptions.
How do I map nullable float correctly in Nhibernate