If I have a class:
Code:
public class Cat
{
private string name;
private int age;
public string Name
{
get { return name; }
set { name = value;}
}
public int age
{
get { return age; }
set { age = value; }
}
}
Whenever I try to read a record from the DB where age has a NULL value in the DB, NHibernate assigns 0 for the age variable. Same thing happens when saving an unassigned age variable, the DB get's a 0.
I need to get and save NULLs instead of 0 for unassigned age, as returning or saving a 0 into the DB isn't the correct value, because the Cat might by 5 years old not 0 and I have just left that value out; therefore I'm storing and working with an incorrect age.
Would normal practice be, instead of using "private int age" to use "private Int32 age"? Or what's the recommended way to work with such data?
Thanks