1
有没有人看到过此异常? Google或Bing的结果绝对非常少。DataAnnotations中的自定义验证器属性异常
IsValid(object value) has not been implemented by this class.
The preferred entry point is GetValidationResult() and classes should override
IsValid(object value, ValidationContext context).
这里的自定义验证:
public class PriceAttribute : ValidationAttribute
{
public string Id { get; set; }
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
//I think this definition for IsValid is in DataAnnotations 4.0
return base.IsValid(value, validationContext);
}
public override bool IsValid(object value)
{
//This I think is the older definition. Not sure why it expects this
return base.IsValid(value);
}
}
谢谢!
这是编译器错误还是有抛出运行时异常?如果是这样,你有没有我们的堆栈跟踪? – Steven 2010-08-29 15:40:28
@Steven - 这是一个编译器错误。我认为它与DataAnnotations的汇编版本有关? – DotnetDude 2010-08-30 15:35:11