From 25cb7cd50d12f48e93d6cde47420ca3458e9c47a Mon Sep 17 00:00:00 2001 From: helongyang <647556386@qq.com> Date: 星期四, 12 六月 2025 21:39:43 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Attributes/ModelValidateAttribute.cs | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Attributes/ModelValidateAttribute.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Attributes/ModelValidateAttribute.cs" index 5e742ef..0f8b12b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Attributes/ModelValidateAttribute.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Attributes/ModelValidateAttribute.cs" @@ -44,7 +44,35 @@ /// </summary> public string[] NotNullAndEmptyWithPropertyAndValue { get; set; } + /// <summary> + /// 璇存槑 + /// </summary> public string Description { get; set; } + + /// <summary> + /// 妫�鏌ョ害鏉燂紝灞炴�у�煎彧鍏佽鏄暟缁勪腑鐨勫�� + /// </summary> + public object[] Check { get; set; } + + /// <summary> + /// 浠�...寮�澶� + /// </summary> + public string StartWith { get; set; } + + /// <summary> + /// 浠�...缁撳熬 + /// </summary> + public string EndWith { get; set; } + + /// <summary> + /// 鏈�灏忛暱搴� + /// </summary> + public int MinLength { get; set; } = 0; + + /// <summary> + /// 鏈�澶ч暱搴� + /// </summary> + public int MaxLength { get; set; } = int.MaxValue; public PropertyValidateAttribute(string description) { @@ -58,9 +86,18 @@ { public ModelValidateType ModelValidateType { get; } = ModelValidateType.SimpleValidate; + public Func<object, (bool, string, object?)> CustomValidateMethod { get; set; } + + public object ErrorResponse { get; set; } + public ModelValidateAttribute() { } + + public ModelValidateAttribute(Func<object, (bool, string, object?)> customValidateMethod) + { + CustomValidateMethod = customValidateMethod; + } } public enum ModelValidateType -- Gitblit v1.9.3