G
Guest
I posted this a couple of days ago, but it was buried with another question.
How do people deal with NULL values in an object model?
Consider the following example often used. I can't see anyway to indicate
an age is undefined. So if I get a null from the database what do I store
here and when placing it on the screen, how do I know to put nothing (as
opposed to 0). Is there a methodology people use? Null indicator variable,
Nullable type, etc. Do I just write compound if statements to test and
determine what to use everywhere? Seems like a very common problem many
other people must be solving in fashion.
Public Class Customer
Private _age As Integer
Public Property Age() As Integer
Get
Return _age
End Get
Set(ByVal value As Integer)
_age = value
End Set
End Property
End Class
How do people deal with NULL values in an object model?
Consider the following example often used. I can't see anyway to indicate
an age is undefined. So if I get a null from the database what do I store
here and when placing it on the screen, how do I know to put nothing (as
opposed to 0). Is there a methodology people use? Null indicator variable,
Nullable type, etc. Do I just write compound if statements to test and
determine what to use everywhere? Seems like a very common problem many
other people must be solving in fashion.
Public Class Customer
Private _age As Integer
Public Property Age() As Integer
Get
Return _age
End Get
Set(ByVal value As Integer)
_age = value
End Set
End Property
End Class