xVal client side and server side validation with DTOs

Jun 15, 2009 at 9:42 PM

Hi,

I'm trying to implement xVal with a project containing a more complex architecture. I don't have access to NHibernate entities inside my controller layer.

I'm using some services to get information from the domain. I'm planning to use the NHibernate.Validator adapter.

Right now i see the solution to implement the server side validation made directly in my domain layers. But i can't see how i can use my dtos to propagate the validation rules for my client side.

 

Does someone already use xVal in this type of architecture.

 

Best Regards

Coordinator
Jun 17, 2009 at 8:53 AM

Hi Sphe

xVal can't know about any rules in your domain classes unless you tell it to go looking for them. One option might be to specify that your domain class is a "buddy class" for the corresponding DTO (using the [MetadataType] attribute as described at http://goneale.com/2009/03/04/using-metadatatype-attribute-with-aspnet-mvc-xval-validation-framework/)

Steve