Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

New Post: Validating Collection of Primitive Types

$
0
0

I think rhe reason you are getting error there is that domains.Any() does not have any lambda in it like this: domains.Any(x => x.whatever == "whatever")

I am not sure where you were going with that Any...

You could do something like this:

RuleFor(x => x.Domains)
    .Cascade(CascadeMode.StopOnFirstFailure)
    .NotNull()
    .WithMessage("Domains cannot be null")
    .SetCollectionValidator(new DomainNameCollectionValidator());

Viewing all articles
Browse latest Browse all 1917

Trending Articles



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