Dear Jeremy,
I have been reading about dependent rules here:
https://github.com/JeremySkinner/FluentValidation/issues/65
From my understanding, a dependent rule will execute only if the preceding rules succeed. However, I cannot get this to work. Ex:
RuleFor(o => o).NotNull().WithMessage("Customer cannot be null")
.DependentRules(d =>
{
If I pass in a customer object which is not null, I expect to validate the first name. However, no validation is fired. What am I doing wrong or what am I missing here?
Thank you for your help,
Michael
I have been reading about dependent rules here:
https://github.com/JeremySkinner/FluentValidation/issues/65
From my understanding, a dependent rule will execute only if the preceding rules succeed. However, I cannot get this to work. Ex:
RuleFor(o => o).NotNull().WithMessage("Customer cannot be null")
.DependentRules(d =>
{
d.RuleFor(x => x.FirstName).NotEmpty().WithMessage("First name cannot be empty");
// Other code to execute here
}); If I pass in a customer object which is not null, I expect to validate the first name. However, no validation is fired. What am I doing wrong or what am I missing here?
Thank you for your help,
Michael