8000 [Feature Request] Add option to set RootContextData · Issue #183 · Blazored/FluentValidation · GitHub
[go: up one dir, main page]

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

@pokorsky

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

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

      0