Explorar el Código

EntityNameService和EntityService只需处理SugarTable实体

Signed-off-by: 清子 <261617183@qq.com>
清子 hace 3 años
padre
commit
e151f8a9fe
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

+ 4 - 0
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

@@ -42,11 +42,15 @@ public static class SqlSugarSetup
         {
             EntityNameService = (type, entity) => // 处理表
             {
+                if (!type.GetCustomAttributes<SqlSugar.SugarTable>().Any())
+                    return;//只需处理SugarTable实体
                 if (config.EnableUnderLine && !entity.DbTableName.Contains('_'))
                     entity.DbTableName = UtilMethods.ToUnderLine(entity.DbTableName); // 驼峰转下划线
             },
             EntityService = (type, column) => // 处理列
             {
+                if (!type.GetCustomAttributes<SqlSugar.SugarColumn>().Any())
+                    return;//只需处理SugarColumn实体
                 if (new NullabilityInfoContext().Create(type).WriteState is NullabilityState.Nullable)
                     column.IsNullable = true;
                 if (config.EnableUnderLine && !column.IsIgnore && !column.DbColumnName.Contains('_'))