From be9603dbad1ac2bc80321aac20057cda87d3b8bc Mon Sep 17 00:00:00 2001 From: kingstien Date: Tue, 19 Jul 2022 09:46:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81double=E5=92=8Cfloat=E8=BD=AC?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Abstract/DbBindProvider/IDataRecordExtensions.cs | 10 ++++++---- .../Abstract/DbBindProvider/IDataRecordExtensions.cs | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs index 829790f45..3f68e0780 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs @@ -302,11 +302,12 @@ namespace SqlSugar object value = dr.GetValue(i); if (value != null) { - if (value.GetType() == UtilConstants.DecType) + var valueType = value.GetType(); + if (valueType.IsIn(UtilConstants.FloatType, UtilConstants.DecType, UtilConstants.DobType)) { value = Convert.ToUInt32(value); } - else if (value.GetType() == UtilConstants.StringType) + else if (valueType == UtilConstants.StringType) { return (T)Enum.Parse(typeof(T), value.ObjToString()); } @@ -320,11 +321,12 @@ namespace SqlSugar object value = dr.GetValue(i); if (value != null) { - if (value.GetType() == UtilConstants.DecType) + var valueType = value.GetType(); + if (valueType.IsIn(UtilConstants.FloatType, UtilConstants.DecType, UtilConstants.DobType)) { value = Convert.ToUInt32(value); } - else if (value.GetType() == UtilConstants.StringType) + else if (valueType == UtilConstants.StringType) { return (T)Enum.Parse(typeof(T), value.ObjToString()); } diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs index 829790f45..3f68e0780 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs @@ -302,11 +302,12 @@ namespace SqlSugar object value = dr.GetValue(i); if (value != null) { - if (value.GetType() == UtilConstants.DecType) + var valueType = value.GetType(); + if (valueType.IsIn(UtilConstants.FloatType, UtilConstants.DecType, UtilConstants.DobType)) { value = Convert.ToUInt32(value); } - else if (value.GetType() == UtilConstants.StringType) + else if (valueType == UtilConstants.StringType) { return (T)Enum.Parse(typeof(T), value.ObjToString()); } @@ -320,11 +321,12 @@ namespace SqlSugar object value = dr.GetValue(i); if (value != null) { - if (value.GetType() == UtilConstants.DecType) + var valueType = value.GetType(); + if (valueType.IsIn(UtilConstants.FloatType, UtilConstants.DecType, UtilConstants.DobType)) { value = Convert.ToUInt32(value); } - else if (value.GetType() == UtilConstants.StringType) + else if (valueType == UtilConstants.StringType) { return (T)Enum.Parse(typeof(T), value.ObjToString()); }