如何防止调用IValidatableObject.Validate
属性并仅为顶级模型调用它?
public abstract class Foo, IValidatableObject
{
public virtual Foo Related { get; set; }
public virtual IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
// This is first called for the 'Related' property
// and then for the model itself
// I want this to be called for the top level model only
}
}