From 2287c8869d2cab4368715a9bb2cfe32bf1c898ae Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 4 Jan 2024 12:16:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E8=A1=A8=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Infrastructure/_IRaCIS/ObjectExtension.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/ObjectExtension.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/ObjectExtension.cs index c861068de..62463e1f3 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/ObjectExtension.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/ObjectExtension.cs @@ -60,7 +60,15 @@ namespace IRaCIS.Core.Infrastructure.Extention string propertyName = property.Name; object propertyValue = property.GetValue(obj); - dictionary.Add(propertyName, propertyValue); + // 如果属性的类型是枚举,将其值保留为整数 + if (property.PropertyType.IsEnum) + { + dictionary.Add(propertyName, (int)propertyValue); + } + else + { + dictionary.Add(propertyName, propertyValue); + } } return dictionary;