Posted on: 4/25/2013 5:11:37 PM | Views : 382

Hi all, 
I've create a custom validator, but my objective is to validate a complete entity. When validating single properties, there may exit just one error message and that would be fine. When validating complete entities, many cases can arise and each one needs its own error message. 
What I haven't found is a way to to generate different error messages. Finally, I ended up throwing ValidationExceptions, but I think it would be better if I can find a way to end the validator with false and its own error message. 
This is my code ... 
public override bool IsValid(object value) { Venta venta = value as Venta; //Write here logic to validate the user is already exist in database like ControlVentasEntities db = new ControlVentasEntities(); Empleado cajero = db.Empleados.Where(e => e.ID == venta.Cajero).FirstOrDefault(); if (cajer ...

Go to the complete details ...