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

New Post: Validation Rule for overall model

$
0
0

Here are a few options:

 

RuleForModel().MustHaveAtLeastOneItemChecked();

RuleFor(model => model).MustHaveAtLeastOneItemChecked(); // not sure if this one is possible or not

ModelRule()..MustHaveAtLeastOneItemChecked();

 

Of course, The ModelRule method (whichever one is chosen) would need to return a different type that has more limited/different options.

I don't think it would make sense to have a lot of the standard validations such as NotEmpty() ,etc.

I really haven't thought through all of the implications of what I'm asking to be honest, and it's not a huge pain to do a workaround at the moment.

 


Viewing all articles
Browse latest Browse all 1917

Trending Articles



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