Default value for bit field

Posts   
 
    
Pablo
User
Posts: 81
Joined: 21-Mar-2005
# Posted on: 14-Jan-2010 23:17:09   

Hello,

I have defined a bit field in the database, with a default value of 1. When I create the entity, and check the value of this field, it says 'false' .... Am I doing something wrong, or is this supposed to be like this?

llblgen v 2.6, sql2k8 express.

Any help would be appreciated,

Paul

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 15-Jan-2010 00:03:05   

This is the expected behavior - default values are not picked up from the database. If you search the forums you will find several discussions about why this is the case.

If you need a default value set your best bet is to create a Manager/Factory class that correctly creates a new entity with the default values all ready set, and ensure that this is used everywhere.

Matt

Pablo
User
Posts: 81
Joined: 21-Mar-2005
# Posted on: 15-Jan-2010 13:41:57   

Matt, ok thats clear ... I'll set a default value in code. Thanks, Paul