Hi Craig
The object being validated is passed as a parameter to the WithState method, so you should be able to use this to access any properties you need to. Something like this should do the trick:
The object being validated is passed as a parameter to the WithState method, so you should be able to use this to access any properties you need to. Something like this should do the trick:
public static IRuleBuilderOptions<T, TProperty> WithRuleName<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, string brokenRuleNamespace, string ruleName, Func<T, object > valueFunc)
{
return rule.WithState(instance => {
object value = valueFunc(instance);
return new FluentValidationRuleState(brokenRuleNamespace, ruleName, value);
});
}