3

I am using FluentValidation in a current project.

Recently I stumbled upon the AbstractValidators Validation Method

ValidationResult IValidator.Validate(ValidationContext<T> validationContext)

I did not find any use cases on why to use this method. When and how would validating using this method be useful?

Thanks for any input.

1
  • 1
    WOW, thanks for pointing out such a wonderful lib Oliver, will try to investigate your question, it looks like the most obvious use case it to inject some services to validation context, may be wrong though. Reading sources now.
    – v00d00
    Apr 25, 2012 at 8:36

1 Answer 1

5

It's been a while but I don't want To hold back Jeremy Skinners answer to my question on Codeplex:

This [The validation context]is used internally by FluentValidation. Your best chance of understanding how this works is to actually read the source code. Here's a quick summary:

The property chain tracks how deeply nested the rule is, for example customer.Address.Line1

Ivalidatorselector is used to determine which rules should run. For example, when you only elect to validate a specific property then this is handled by a different ValidatorSelector.

Jeremy Skinner

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.