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

New Post: Greater than or equals comparison against an enum with Fluent Validation?

$
0
0

Thanks for the quick response Jeremy.  This is what I'm looking for, but I'm still getting issues with trying to implement your suggestion.

I'm looking to apply the same condition to multiple rules, so your second example is applicable.

Unfortunately, I get an error msg

"A local variable named 'x' cannot be declared in this scope because it would give a different meaning to 'x', which is already used in a 'parent or current' scope to denote something else"

So I renamed the when clause's variable and I got a message "The name When does not exist in the current context"

So I tried prefixing the When clause with FluentValidation.DefaultValidatorOptions.When I get the following error msg

The type arguments for method 'FluentValidation.DefaultValidatorOptions.When<T,TProperty>(FluentValidation.IRuleBuilderOptions<T,TProperty>, System.Func<T,bool>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

Any suggestions?


Viewing all articles
Browse latest Browse all 1917

Trending Articles



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