namespace Yw.Application.Health { /// /// 自动评价 /// public class AutoEvaluation : Model.JsonModel, IValidatableObject { /// /// 子项列表 /// [Required] public List Items { get; set; } /// /// /// public IEnumerable Validate(ValidationContext validationContext) { if (this.Items == null || this.Items.Count < 1) { yield return new ValidationResult( "Items 不能为空" , new[] { nameof(Items) } ); } else if (this.Items.Exists(x => x == null)) { yield return new ValidationResult( "Items 存在无效项" , new[] { nameof(Items) } ); } } } }