I’m using mvc3 + fluent validaton + ninject
I have simple controller and the model that don’t have validation configured(Pager)…but fluent validation is triggered on that object too, so code breaks up and exception is thrown:
> Error activating IValidator{Pager}
I looked up in source and found this method which suppose to check if it needs to validate some property or not, but it only check if values are not null:
bool IsValidatingProperty(ModelMetadata metadata) {
return metadata.ContainerType != null && !string.IsNullOrEmpty(metadata.PropertyName);
}
I suppose there are some config trick around this problem, in short: I want to FV be triggered only on objects on which I have FV rules defined…
Thanx 😉
After suggestion from Jeremy
http://fluentvalidation.codeplex.com/workitem/7091
I found that solution to problem is not so hard: