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

New Post: FluentValidation setting RuleFor in Validate instead of Constructor?

$
0
0
Hi

I personally wouldn't use FluentValidation for this.

FluentValidation is designed for situations where you know the rules that you need in advance - it isn't designed for situations where you're looking to dynamically create rules on-the-fly.

When I need to do this kind of dynamic validation then I tend to encapsulate this into a separate validation object which doesn't make use of FluentValidation, but instead handles its own rule creation. There's no problem with mixing FV with other sources of validation within the same project.

Jeremy

Viewing all articles
Browse latest Browse all 1917

Trending Articles



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