Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamic error message within builder #7

Open
mr5z opened this issue Dec 19, 2023 · 0 comments
Open

Add dynamic error message within builder #7

mr5z opened this issue Dec 19, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mr5z
Copy link
Owner

mr5z commented Dec 19, 2023

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)";
        }
    });
@mr5z mr5z added enhancement New feature or request help wanted Extra attention is needed labels Dec 19, 2023
@mr5z mr5z changed the title Add dynamic error message within ValidationService instance Add dynamic error message within builder Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant