RE: Business Objects



Please check out nullable types in .Net 2.0. DateTime? can be null but
DateTime cannot. We have switched are data access code to use this technique.

macfarmw


"pothik" wrote:

I have the following sample class where the property value will come from the
database and in the database the value can be null. I believe this is a
common problem if one wants to design bisuness objects. I have read about the
concepts in many books but no one talks about to solve this problem.

In .Net 2.0 there is a solution, but since this is a common problem, I was
wondering how other have solved it before.

public class SampleClass
{
private string stringProp;
private int intProp;
private DateTime dateProp;

public SampleClass()
{
//
// TODO: Add constructor logic here
//
}

public int IntProp
{
get
{
return intProp;
}
set
{
intProp = value;
}
}

public string StringProp
{
get
{
return stringProp;
}
set
{
stringProp = value;
}
}

public DateTime DateProp
{
get
{
return dateProp;
}
set
{
dateProp = value;
}
}
}

.