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

New Post: Validation Rule for overall model

$
0
0

Is there a proper way to create a fluent validation rule for the overall model and not a specific property?

What I am doing today is sometimes using a unrelated property that is never displayed for the rule:

RuleFor(model => model.Id).MustHaveAtLeastOneItemChecked();

The rule would basically check some other properties in my model to make sure at least one of them is set to true. How is this normally accomplished in FluentValidation? I don't always have an arbitrary property to add the rule to.


Viewing all articles
Browse latest Browse all 1917

Trending Articles



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