From c9fcd2818154f13dc998d117a1982e4cbc2a78cf Mon Sep 17 00:00:00 2001
From: falcon <9504402@qq.com>
Date: Fri, 14 Oct 2022 12:21:21 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE=E5=BA=93?=
=?UTF-8?q?=E5=88=97=E6=9C=8D=E5=8A=A1=EF=BC=8C=E6=94=AF=E6=8C=81=E6=89=80?=
=?UTF-8?q?=E6=9C=89=E6=95=B0=E6=8D=AE=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../{SetupKey.cs => SetupKeyColumnServices.cs} | 2 +-
.../{SetupLength.cs => SetupLengthColumnServices.cs} | 7 +++----
.../{SetupNullable.cs => SetupNullableColumnServices.cs} | 2 +-
.../DatabaseDefinitions/SugarConnectionConfig.cs | 6 +++---
4 files changed, 8 insertions(+), 9 deletions(-)
rename Falcon.SugarApi/DatabaseDefinitions/EntityServices/{SetupKey.cs => SetupKeyColumnServices.cs} (87%)
rename Falcon.SugarApi/DatabaseDefinitions/EntityServices/{SetupLength.cs => SetupLengthColumnServices.cs} (77%)
rename Falcon.SugarApi/DatabaseDefinitions/EntityServices/{SetupNullable.cs => SetupNullableColumnServices.cs} (94%)
diff --git a/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupKey.cs b/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupKeyColumnServices.cs
similarity index 87%
rename from Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupKey.cs
rename to Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupKeyColumnServices.cs
index 3a9250f..730e38c 100644
--- a/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupKey.cs
+++ b/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupKeyColumnServices.cs
@@ -7,7 +7,7 @@ namespace Falcon.SugarApi.DatabaseDefinitions.EntityServices
///
/// 设置主键
///
- public class SetupKey : IEntityColumnServices
+ public class SetupKeyColumnServices : IEntityColumnServices
{
///
public void SetupColumn(PropertyInfo p, EntityColumnInfo c) {
diff --git a/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupLength.cs b/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupLengthColumnServices.cs
similarity index 77%
rename from Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupLength.cs
rename to Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupLengthColumnServices.cs
index 732f968..c09c611 100644
--- a/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupLength.cs
+++ b/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupLengthColumnServices.cs
@@ -9,7 +9,7 @@ namespace Falcon.SugarApi.DatabaseDefinitions.EntityServices
///
/// 设置长度规则
///
- public class SetupLength : IEntityColumnServices
+ public class SetupLengthColumnServices : IEntityColumnServices
{
///
public void SetupColumn(PropertyInfo p, EntityColumnInfo c) {
@@ -20,10 +20,9 @@ namespace Falcon.SugarApi.DatabaseDefinitions.EntityServices
if (p.TryGetAttribute(out var la)) {
len.Add(la.Length);
}
- if (p.TryGetAttribute(out var sc) && sc.Length != 0) {
- len.Add(sc.Length);
+ if (len.Any()) {
+ c.Length = len.Max();
}
- c.Length = len.Max();
}
}
}
diff --git a/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupNullable.cs b/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupNullableColumnServices.cs
similarity index 94%
rename from Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupNullable.cs
rename to Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupNullableColumnServices.cs
index 07c9c87..f3311e3 100644
--- a/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupNullable.cs
+++ b/Falcon.SugarApi/DatabaseDefinitions/EntityServices/SetupNullableColumnServices.cs
@@ -8,7 +8,7 @@ namespace Falcon.SugarApi.DatabaseDefinitions.EntityServices
///
/// 设置Nullable
///
- public class SetupNullable : IEntityColumnServices
+ public class SetupNullableColumnServices : IEntityColumnServices
{
///
public void SetupColumn(PropertyInfo p, EntityColumnInfo c) {
diff --git a/Falcon.SugarApi/DatabaseDefinitions/SugarConnectionConfig.cs b/Falcon.SugarApi/DatabaseDefinitions/SugarConnectionConfig.cs
index 46fddde..2d7c74b 100644
--- a/Falcon.SugarApi/DatabaseDefinitions/SugarConnectionConfig.cs
+++ b/Falcon.SugarApi/DatabaseDefinitions/SugarConnectionConfig.cs
@@ -32,9 +32,9 @@ namespace Falcon.SugarApi.DatabaseDefinitions
static SugarConnectionConfig() {
TableServices.Add(new TableNameTableService());
- ColumnServices.Add(new SetupKey());
- ColumnServices.Add(new SetupLength());
- ColumnServices.Add(new SetupNullable());
+ ColumnServices.Add(new SetupKeyColumnServices());
+ ColumnServices.Add(new SetupLengthColumnServices());
+ ColumnServices.Add(new SetupNullableColumnServices());
}
///