ASP.NET MVC3 Fluent Validation Constructor hit multiple times per request

I have an ASP.NET MVC3 website setup using free validation and ninject. The verification code works. However, I set a breakpoint in the constructor of the validation class, and I noticed that when I request my view, which uses validation, the constructor gets it several times. Based on very basic testing, it seems that the number of strokes of the constructor is equal to the number of properties that exist on the object. Does anyone else come across something similar? Or maybe someone shed more information on how this type of check works behind the scenes? -Thank

Here is the constructor ...

public class PersonValidator : AbstractValidator<Person> {
    public PersonValidator() {
        RuleFor(x => x.Id).NotNull();
        RuleFor(x => x.Name).Length(0, 10);
        RuleFor(x => x.Email).EmailAddress();
        RuleFor(x => x.Age).InclusiveBetween(18, 60);
    }
}

Here are the libraries / resources that I use (I just received NuGet packages and configured everything based on the information from the two links below):

http://fluentvalidation.codeplex.com/wikipage?title=mvc https://github.com/ninject/ninject.web.mvc.fluentvalidation

+5
1

, . , , - ?

, Ninject.

InRequestScope(). HTTP-, . , , , HTTP- , . , ?

Bind(match.InterfaceType).To(match.ValidatorType).InRequestScope();
+4

All Articles