c# - FluentValidation occures even on models that do not have any validators set -
I am using FluentValidation with MVC 3.0; I have configured this to work with a custom validator factory and IOC container;
Everything works fine and I am able to do custom verification with my dependence and inject them ... but a strange thing has happened: all the strongly typed ideas on which I HtmlHelper control is created (ex: HTML .Editor), it seems that MVC is trying to illustrate a verifier that does not need any check to see if I have models in those sequences, and no validator Models have been mapped to unity, because it is a unity error ... valid, and no automatic model is binding, so how can I stop it from happening? I do not have to register for unity in order to make the vacant valid for each model and get rid of these errors.
How do I register in the factory at the global level here:
FluentValidationModelValidatorProvider.Configure (provider = & gt; {provider.ValidatorFactory = new UnityValidatorFactory (container);}) ; Data AnnotationModelValendarProvisor.ADMpliantAirEditifyOldPayments = false; And how do I register my custom authors:
container.RegisterType & lt; IValidator & LT; XViewModel>, XViewModel & gt; (New ContainerControlledLifetimeManager), New InjectionConstructor (Container. Resolve; ILocalizationService & gt; (), Container Resolve & lt; ISessionService & gt; ())); For XView, everything is fine, and in my methodology, I try TrydateModel and verification is working properly; But for other scenes where I do not want to make any recognition, MVC still tries to solve the verifier for them and is not normally anything because registered in unity fails
Do you have any idea about fixing it?
Thanks
Edit: Other views have errors: Current type, IValidator`1 [. ..ViewModel], has an interface and can not be manufactured. If you are losing a type mapping? "itemprop =" text "> The type can not be sorted when I modified to return my UnityValidatorFactory Null; I do not know how this performance is from the perspective of performance (one exception has been raised), but at the moment I do not have a better solution ...
Comments
Post a Comment