diff --git a/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupLengthColumnServices.cs b/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupLengthColumnServices.cs
index 7be2c9e..7661087 100644
--- a/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupLengthColumnServices.cs
+++ b/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupLengthColumnServices.cs
@@ -1,4 +1,5 @@
using SqlSugar;
+using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@@ -9,22 +10,19 @@ namespace Falcon.SugarApi.DatabaseDefinitions.EntityServices
///
/// 设置长度规则
///
- public class SetupLengthColumnServices : IEntityColumnServices
+ public class SetupLengthColumnServices:IEntityColumnServices
{
///
- public void SetupColumn(PropertyInfo p, EntityColumnInfo c) {
- var len = new List();
- if (p.TryGetAttribute(out var sl)) {
+ public void SetupColumn(PropertyInfo p,EntityColumnInfo c) {
+ var len = new List { };
+ if(p.TryGetAttribute(out var sl)) {
len.Add(sl.MaximumLength);
}
- if (p.TryGetAttribute(out var la)) {
+ if(p.TryGetAttribute(out var la)) {
len.Add(la.Length);
}
- if (p.TryGetAttribute(out var sc)) {
- len.Add(sc.Length);
- }
- if (len.Any()) {
- c.Length = len.Max();
+ if(len.Any()) {
+ c.Length=len.Reduce(c.Length,(m,i) => Math.Max(m,i));
}
}
}