I have some code that enumerates over an object and records any errors it has based on its ValidationAttribute(s).
As it finds them I wish to create a collection of a custom class named RuleViolations. The RuleViolation class looks like this:
public string Message { get; set; }
public LambdaExpression Property { get; set; }
Property is a lambda expression so that the property doesn't have to be a string. THis works when I manually add errors but I'm not sure how to specify the LambdaExpression when all I have is the property's PropertyDescriptor object.
Does anyone know how?