Default Value

Posts   
 
    
tsmith
User
Posts: 38
Joined: 17-Apr-2006
# Posted on: 12-Jun-2006 19:36:40   

How do you set a default value on a new entity that does not have a default in the table. This property would be read-only. Ex. On new item, I would always say entity.field = 10;

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 12-Jun-2006 22:38:36   

Please see 'Add your own code to the generated classes' in the documentation and add code like this: if(this.Fields.State == EntityState.New) { this.FieldName = 10; }

to the initclass method of the entity. (initclassempty). Either to the user code region, or use an include template.

Frans Bouma | Lead developer LLBLGen Pro