Quantcast
Channel: xval Discussions Rss Feed
Viewing all articles
Browse latest Browse all 21

New Post: Does xVal need data annotations on the model?

$
0
0

Does xVal only work with data annotations? Is is possible to keep my domain entities clean of validation annotations? I see the following:

"you can also write your own IRulesProvider to attach rules programmatically or using any other .NET validation framework.: but have not seen any implemtation of this.

I have been working with FluentValidation which allows you to abstract the validation like:

publicclass Person

{
     publicstring Name {get;set;}
}publicclass PersonValidator: AbstractValidator<Person>
    {public PersonValidator()
        {
            RuleFor(x => x.Name).NotEmpty().Length(2);
        }
}

ValidationResult result = Person.Validate(new PersonValidator());

I want to try and keep my domain model free from a lot of annotations. Is something similar possible with xVal?

Cheers

 


Viewing all articles
Browse latest Browse all 21

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>