After a few months of using FluentValidation I asked its author Jeremy Skinner if it were possible to integrate this with xVal. At that time it was not possible because there were no easy way to access the properties needed by xVal. After submitting a few patches, we now have a solution which enables xVal integration with most of the FV validators.
It currently supports the following FV validatiors:
- ComparisonValidator including:
- Not Equal
- Greater Than or Equal
- Less Than or Equal
To configure the integration we need to tell xVal to use the FV rules provider rather than the default one. This is done in the global.asax.cs in Application_Start().
The rules provider here is instructed to use the AttributedValidatorFactory to instruct the provider to use the attribute attached to the model class to find the validation class for that model.
Note: This is still new and xVal is still in beta so there may be some issues. If you find any please let me know so we can fix them as soon as possible.
Hopefully once its ready it can be checked in with the other providers at the xVal codeplex site.
This is currently in the development source code which can be downloaded and tried now.