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

New Post: How to by pass calling the InstanceCache?

$
0
0
Apologies for the late reply. I've been out of the country with no internet access.

The simplest thing to do would be to use the overload of LessThan that takes a lambda. This way the call to DateTime.Now will be lazily-evaluated:
RuleFor(x => x.TradeDate).LessThan(x => DateTime.Now.Date.AddDays(1));
Alternatively if you want to turn off the instance cache for all validators then you can provide your own implementation of IValidatorFactory that doesn't make use of the InstanceCache.

Viewing all articles
Browse latest Browse all 1917

Trending Articles



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