Default Values

Posts   
 
    
Posts: 30
Joined: 17-Sep-2006
# Posted on: 23-Jun-2007 15:09:19   

Hi everyone,

I've been meaning to investigate LLBLGen Pro properly for ages - but have only had time to start looking now.... and I've got a simple question for you! What's the best way to specify a default value for an entity property (when inserting)?

I want to do this somewhere in the business/entity logic, rather than setting a default property in the database (unless anyone has arguments for not doing this?).

Cheers

James

Posts: 30
Joined: 17-Sep-2006
# Posted on: 23-Jun-2007 15:12:55   

Just to clarify, at the moment I'm simply talking about making sure certain integer and varchar fields get set to 0/String.Empty on insertion. If I check the property of the entity before insertion, I get LLBLGen's default value for those non-nullable fields - but it doesn't pass these values on to the database...

Posts: 254
Joined: 16-Nov-2006
# Posted on: 23-Jun-2007 23:19:04   

I would avoid specifying defaults in LLBLGen if the database supports specifying a default. I'm aware of any database platform which doesn't provide default support.

The only way to default values in LLBLGen is through the generated code in the constructor, there is no way through the designer.