Non required fields in the db...

Posts   
 
    
pilotboba
User
Posts: 434
Joined: 05-Aug-2005
# Posted on: 06-Aug-2005 19:17:00   

Hello,

I am evaling your product and I have a quesiton on the db design.

I am porting a Visual FoxPro app to .Net. In the fw I used it wasn't really to good at handling nulls in the db. So, for non-required fields, instead of allowing nulls we set a db default empty (of type) for the field. So, all non-required varchars have a default of (''), all bits and numerics have a value of 0, etc.

What would be a better choice with LLBL generated objects. Continuing with the defaults or dropping the defaults and setting the fields to allow null?

Thanks, BOb

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 06-Aug-2005 19:45:59   

LLBLGen Pro entities in memory don't use null values, as for example an int field can't have a null value.

It depends on what you prefer: some don't want NULL values in their databases and define default constraints (like you mentioned), others don't care and deal with the NULL values. LLBLGen Pro can deal with default constraints without a problem. Just save an entity without setting the optional fields to a value, and when refetching is specified (adapter) (in selfservicing this is automatically done when you touch a property again) the default values inserted into the row are read.

Frans Bouma | Lead developer LLBLGen Pro