FluentValidation: Check if one of two fields are empty
问题 I have this model public class Person { public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } } I want to create a validation where either FirstName or LastName must be filled in by user. I installed FluentValidation and created a customvalidator class public class PersonValidator:AbstractValidator<Person> { public PersonValidator() { RuleFor((person=>person.FirstName)//don't know how to check if one is empty } } To check just one field I could