是否可以将参数发送到自定义验证规则?
我的验证规则:
public class CustomTypeSelectedRule : IValidationRule
{
public ValidationResult Validate(object input)
{
// Here I need an extra value from the class calling
// the validation rule.
return ValidationResult.Success;
}
}
我的属性使用validationrule:
[ContractValidation(typeof(ValidationRules.CustomTypeSelectedRule))]
public int CustomType
{
get
{
return this.customType;
}
set
{
this.customType = value;
}
}
感谢任何意见,谢谢!
答案 0 :(得分:1)