The FluentValidation allows to pass custom data as a dictionary to Validation call. It is possible by creating ValidationContext with RootContextData.
var person = new Person();
var context = new ValidationContext<Person>(person);
context.RootContextData["MyCustomData"] = "Test";
var validator = new PersonValidator();
validator.Validate(context);
The current FluentValidationValidator.Validate accepts only the options parameter. No way to pass the validation context.
I tried to build EditContext using ValidationContext but it did not work as EditContextFluentValidationExtensions.ValidateModel does not expect such an option and it always creates its own ValidationContext.
var context = new ValidationContext<Person>(person);
_editContext = new EditContext(context)
It would be great to extend API to allow to pass the ValidationContext the same way as validation options and support it in EditContextFluentValidationExtensions.ValidateModel.
The FluentValidation allows to pass custom data as a dictionary to Validation call. It is possible by creating
ValidationContext
withRootContextData
.The current
FluentValidationValidator.Validate
accepts only the options parameter. No way to pass the validation context.I tried to build
EditContext
usingValidationContext
but it did not work asEditContextFluentValidationExtensions.ValidateModel
does not expect such an option and it always creates its ownValidationContext
.It would be great to extend API to allow to pass the
ValidationContext
the same way as validation options and support it inEditContextFluentValidationExtensions.ValidateModel
.Or did I miss something? Thanks