Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does ServiceStack not implement the ruleSet optional parameter in the Validate method?

Why does ServiceStack not implement the ruleSet optional parameter in the Validate method?

enter image description here

like image 464
Daniel Gartmann Avatar asked Mar 08 '15 18:03

Daniel Gartmann


1 Answers

I have found you can call it by casting to AbstractValidator

var validator = new PersonValidator();
var person = new Person();
var result = ((AbstractValidator<Person>)validator).Validate(person, ruleSet: "Names");

It seems that form of IValidator.Validate() is an extension method, so you could instead add a using statement to your cs file, and it should work as-is.

using ServiceStack.FluentValidation;
like image 55
Raul Nohea Goodness Avatar answered Nov 02 '22 03:11

Raul Nohea Goodness