namespace Yw.Dto.Curve { /// /// /// public class CurveExpressInput : IValidatableObject { /// /// 拟合类型 /// public eFitType FitType { get; set; } /// /// 定义点列表 /// public List DefinePoints { get; set; } /// /// /// public IEnumerable Validate(ValidationContext validationContext) { if (DefinePoints == null || DefinePoints.Count < 1) { yield return new ValidationResult("DefinePoints 数量不足,至少4个点", new string[] { nameof(DefinePoints) }); } var fitPow = FitHelper.GetFitPow(FitType); if (DefinePoints.Count < fitPow + 1) { yield return new ValidationResult($"DefinePoints 数量不足,至少{fitPow + 1}个点", new string[] { nameof(DefinePoints) }); } } } }