Jezz Santos - 106 - Apr 22, 2014

RE: Validation Reuse

I have some objects inside the layers of services that require validation at various points. Would be good to reuse some of the ancillary Validators that are already used by SS for validating DTO’s.

Is there a helper pattern or method with which I can apply validators in my code in any location? Just a pointer to some doco would be enough, or a sample?

Not sure if this is what you’re after but you can use the ValidateAndThrow method to validate a request inline, e.g:

https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack/Auth/RegisterService.cs#L79

Jezz Santos:

Thanks
__________