Skip to content
This repository was archived by the owner on Dec 26, 2025. It is now read-only.
This repository was archived by the owner on Dec 26, 2025. It is now read-only.

[Feature Request] Add option to set RootContextData #183

Description

@pokorsky

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.

Or did I miss something? Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature RequestRequest to add a new featureTriageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions