using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WIDESEAWCS_Core.Attributes { [AttributeUsage(AttributeTargets.Property)] public class PropertyValidateAttribute : Attribute { /// /// 最大值 /// public int MaxValue { get; set; } = int.MaxValue; /// /// 最小值 /// public int MinValue { get; set; } = int.MinValue; /// /// 非空 /// public bool NotNullAndEmpty { get; set; } = true; /// /// 是否包含最大值 /// public bool IsContainMaxValue { get; set; } = false; /// /// 是否包含最小值 /// public bool IsContainMinValue { get; set; } = false; /// /// 根据其他属性非空判断当前是否为非空 /// public string NotNullAndEmptyWithProperty { get; set; } /// /// 根据其他属性值判断当前是否为非空(格式【new string[]{ "属性名称", "属性值" }】) /// public string[] NotNullAndEmptyWithPropertyAndValue { get; set; } public string Description { get; set; } public PropertyValidateAttribute(string description) { if (!string.IsNullOrEmpty(description)) Description = description; } } [AttributeUsage(AttributeTargets.Class)] public class ModelValidateAttribute : Attribute { public ModelValidateType ModelValidateType { get; } = ModelValidateType.SimpleValidate; public ModelValidateAttribute() { } } public enum ModelValidateType { SimpleValidate, CustomValidate, SimpleAndCustom } }