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
Hi,

My situation is. I have a validator trying to make sure the user has not entered a future date. so I have a validator like this.
public class BasedViewModelValidator<T> : AbstractValidator<T> where T : BasedViewModel
    {
        public BasedViewModelValidator()
        {
            RuleFor(x => x.TradeDate).LessThan(DateTime.Now.Date.AddDays(1));
        }
    }
The issue is that the InstanceCache "cached" the validator instance and would render the rule invalid after one day.

How could I work around this issue? or disable the caching altogether?

Thanks,

J.

Viewing all articles
Browse latest Browse all 1917

Trending Articles



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