Skip to content

Add dynamic error message within builder #7

Description

@mr5z

Implement it something like below:

validationService.For(....)
    .AddRule(e => e.FirstName, new StringRequiredRule(), new new RangeLengthRule(10, 15))
    .OverrideErrorMessage((propertyName, rule) => {
        if (propertyName == nameof(FirstName))
        {
            return $"First Name must be within ({FirstName.Length}/15)";
        }
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions