Validation MVC数据注释与继承

Validation MVC数据注释与继承,validation,asp.net-mvc-5,jquery-validate,data-annotations,Validation,Asp.net Mvc 5,Jquery Validate,Data Annotations,我有以下体系结构: public abstract class ApplicationDriverFormAbstractVM : IValidatableObject { [Display(Name = "Job applied For")] public virtual string JobAppliedFor { get; set; } [Display(Name = "Has any license, permit, or privilege ever been

我有以下体系结构:

public abstract class ApplicationDriverFormAbstractVM : IValidatableObject
{
    [Display(Name = "Job applied For")]
    public virtual string JobAppliedFor { get; set; }

    [Display(Name = "Has any license, permit, or privilege ever been suspended, revoked, or denied?")]
    public virtual bool? HasDeniedLicenses { get; set; }
    [Display(Name = "Have you ever been convicted for driving under the influence of drugs or alcohol?")]
    public virtual bool? HasAlcohol { get; set; }
    [Display(Name = "Have you ever tested positive or refused to test on any pre-employment drug and / or alcohol test administered by an employer to which you applied for but did not obtain safety sensitive transportation work covered by DOT agency drug and alcohol testing rules during the past 2 years?")]
    public virtual bool? HasDOTAlcohol { get; set; }
    [Display(Name = "Have you ever been convicted of a felony or misdemeanor?")]
    public virtual bool? HasFelony { get; set; }


public class ApplicationDriverEditVM : ApplicationDriverFormAbstractVM
{
    [Required]
    public override string JobAppliedFor { get; set; }
    [Required]
    public override bool? HasDeniedLicenses { get; set; }
    [Required]
    public override bool? HasAlcohol { get; set; }
    [Required]
    public override bool? HasDOTAlcohol { get; set; }
    [Required]
    public override bool? HasFelony { get; set; }
}

但是这个[Required]属性在客户端不起作用。如果我删除继承,并且只有一个具有[Required]属性的类,它就可以正常工作。为什么会这样?

有一些解决方案使用ModelBinder来覆盖基类模型属性。即使我知道的不多…阅读此文有一些解决方案使用ModelBinder来覆盖基类模型属性。即使我知道的不多…阅读此文