adding IEntityValidator

Posts   
 
    
mdissel
User
Posts: 92
Joined: 16-Sep-2003
# Posted on: 06-Jan-2006 17:06:13   

Hello

What's the best way of adding a IEntityValidator to some of the classes?

Should i change the constructor in the generated Entity classes to assign the IEntityValidator? (with risk of loosing the code when regenerating the code)? or ...

I need three levels of validation at entity level (some example): - insert, you can't add an orderline to a already payed order - update, you can't change an orderline to a already payed order - delete, you can't delete an orderline to a already payed order

(using selfservice entities)

Thanks

Marco

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 07-Jan-2006 13:08:31   

Please consult 'Adding your own code to the generated code' in the 1.0.2005.1 manual and create a simple include template which generates the setter code to all entity's init routine (or to limited entities if you define that in your template, which can be a TDL or a .lpt template (<%..%>)

Frans Bouma | Lead developer LLBLGen Pro
mdissel
User
Posts: 92
Joined: 16-Sep-2003
# Posted on: 08-Jan-2006 16:03:21   

Ok. so i have to write my own IEntityValidator template and make a copy of the default config file and include my own template. Correct?

This seems like a basic validator class, maybe add this as an (configurable) option to the default templates?

ps. any ready to use samples? wink

Thanks Marco