From 0d1aa38d927e7d2e866f308e74e07d5671f16d24 Mon Sep 17 00:00:00 2001 From: YHS Date: Tue, 4 Apr 2023 10:19:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcodefirst=E4=BB=8Exml?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E5=B1=9E=E6=80=A7=E6=B3=A8=E9=87=8A=E6=97=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=AF=BB=E5=8F=96=E7=88=B6=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=EF=BC=8C=E5=AF=BC=E8=87=B4=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=A1=A8=E6=9C=89=E7=9A=84=E5=AD=97=E6=AE=B5=E6=9C=89?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=9C=89=E7=9A=84=E6=B2=A1=E6=9C=89=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Abstract/EntityMaintenance/EntityMaintenance.cs | 7 ++++--- .../Abstract/EntityMaintenance/EntityMaintenance.cs | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs b/Src/Asp.Net/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs index 27ad9e962..4eddc2a62 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs @@ -234,14 +234,15 @@ namespace SqlSugar /// the code annotation for the field public string GetPropertyAnnotation(Type entityType, string dbColumnName) { - if (entityType.IsClass() == false) + if (entityType.IsClass() == false || entityType == typeof(object)) { return null; } - var result= GetXElementNodeValue(entityType, $"P:{entityType.FullName}.{dbColumnName}"); + + var result = GetXElementNodeValue(entityType, $"P:{entityType.FullName}.{dbColumnName}"); if (string.IsNullOrEmpty(result)) { - return null; + return GetPropertyAnnotation(entityType.BaseType, dbColumnName); } else { diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs index 27ad9e962..4eddc2a62 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs @@ -234,14 +234,15 @@ namespace SqlSugar /// the code annotation for the field public string GetPropertyAnnotation(Type entityType, string dbColumnName) { - if (entityType.IsClass() == false) + if (entityType.IsClass() == false || entityType == typeof(object)) { return null; } - var result= GetXElementNodeValue(entityType, $"P:{entityType.FullName}.{dbColumnName}"); + + var result = GetXElementNodeValue(entityType, $"P:{entityType.FullName}.{dbColumnName}"); if (string.IsNullOrEmpty(result)) { - return null; + return GetPropertyAnnotation(entityType.BaseType, dbColumnName); } else {