我看到了 ValidateIsLesser 和 ValidateIsGreater 属性。但是如果我想做一个 ValidateIsLesserOrEqual 和/或 ValidateIsGreaterOrEqual。我是否只需要编写这些自定义属性,或者是否有我很难找到的预建功能?
[ValidateNonEmpty]
[ValidateDate]
[ValidateIsLesser(IsLesserValidationType.Date, "EndDate", "Start Date must be before End Date.")]
public DateTime StartDate { get; set; }
[ValidateNonEmpty]
[ValidateDate]
[ValidateIsGreater(IsGreaterValidationType.Date, "StartDate", "End Date must be after the Start Date.")]
public DateTime EndDate { get; set; }