using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Application { /// /// 数据标准对接input /// public class DataDockingStandardInput : IValidatableObject { /// /// 注册码 /// [Required] public string RegisterCode { get; set; } /// /// 记录列表 /// [Required] public List Records { get; set; } /// /// /// public IEnumerable Validate(ValidationContext validationContext) { if (string.IsNullOrEmpty(RegisterCode)) { yield return new ValidationResult( "RegisterCode 不能为空" , new[] { nameof(RegisterCode) } ); } if (Records == null || Records.Count < 1) { yield return new ValidationResult( "Records 不能为空" , new[] { nameof(Records) } ); } } } }