Browse Source
Merge pull request #1047 from kingstien/SqlSugar5
支持double和float转枚举
SqlSugar5
果糖网
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
8 deletions
-
Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs
-
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()); |
|
|
|
} |
|
|
|
|
|
@ -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()); |
|
|
|
} |
|
|
|