1

Anyone know if it is possible to use FluentValidation with BeginCollectionItem which appends GUIDs to the field/property names? I was able to set up the validator:

RuleForEach(x => x.Insureds).SetValidator(new InsuredInfoValidator());

public class InsuredInfoValidator : AbstractValidator<InsuredInfo>
{
    public InsuredInfoValidator()
    {
        RuleFor(x => x.LastName).NotEmpty().WithMessage("Required");
    }
}

Insureds is my collection. The ModelState validates correctly, but the message does not get placed next to the invalid field: LastName.

Ryan Buening
  • 1,559
  • 2
  • 22
  • 60

0 Answers0