This repository was archived by the owner on Dec 26, 2025. It is now read-only.
Replies: 1 comment 1 reply
-
|
@mishael-o public bool IsDateFromValid() => new DateValidator().Validate(DateFrom).IsValid;Then call the function in the other abstract validator using Must or MustAsync public class FooValidator : AbstractValidator<Foo>
{
DateTime dateFrom , dateTo;
publicFooValidator()
{
RuleFor(x => x.DateFrom)
.Must(date => new DateValidator.Validate(dateFrom = date).IsValid)
.WithMessage("SomeMsg");
RuleFor(x => x.DateTo)
.Must(date => new DateValidator().Validate(dateFrom).IsValid &&
new DateValidator().Validate(dateTo = date).IsValid)
.WithMessage("SomeMsg");
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have a scenario where I would want to revalidate a property when another property has changed.
Example
DateFromandDateToproperties. WhenDateFromchanges I want to call validations forDateToand vice versa to ensure their states is in sync.I see the
FluentValidationValidatorexposesValidateandValidateAsynchowever there is no API validating a property.Beta Was this translation helpful? Give feedback.
All reactions