How to use Reflection in FluentValidation?
问题 I have a scneario in which I want to use reflection to do validation using FluentValidation. Someting like this: public class FooValidator : AbstractValidator<Foo> { public FooValidator(Foo obj) { // Iterate properties using reflection var properties = ReflectionHelper.GetShallowPropertiesInfo(obj); foreach (var prop in properties) { // Create rule for each property, based on some data coming from other service... //RuleFor(o => o.Description).NotEmpty().When(o => // this works fine when foo