how to probagate errors in related entity while validating

Posts   
 
    
vairam2008
User
Posts: 86
Joined: 11-Mar-2008
# Posted on: 12-Apr-2008 01:46:06   

Obsolete. Collections don't store validator objects anymore. Present to make sure users can continue designing their forms in vs.net

Order OrderItems.

How to progress validate success/failure scenario to know if the validation on OrderItems was successfully. by running through a loop or may be LINQ or is there an inherent method in the EntityCollection class?

Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 15-Apr-2008 07:06:52   

Hi Vairam,

What I would do is:

  • Write a Validator for my OrderItemEntity class. I would put there the ValidateFieldEntity and ValidateEntityBeforeSave. So if there's a problem in some item, the I thrown an exception to the whole transaction will rollback.

  • Write a Validator for my OrdenEntity class. I would put there the validation logic for the order's fields (ValidateFieldEntity) and ValidateEntityBeforeSave (here I can put validation to check whether or not the order contains items).

You can check some validation examples at LLBLGen site.

Cheers

David Elizondo | LLBLGen Support Team