mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Update util mehtod
This commit is contained in:
@@ -159,7 +159,7 @@ namespace SqlSugar
|
||||
DbColumnInfoList = DbColumnInfoList.Where(it => {
|
||||
if (it.Value.ObjToString()=="0" && it.PropertyType.IsEnum)
|
||||
{
|
||||
return it.Value.ObjToInt() != UtilMethods.DefaultForType(it.PropertyType).ObjToInt();
|
||||
return it.Value.ObjToLong() != UtilMethods.DefaultForType(it.PropertyType).ObjToLong();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -22,6 +22,21 @@ namespace SqlSugar
|
||||
return reval;
|
||||
}
|
||||
|
||||
public static long ObjToLong(this object thisValue)
|
||||
{
|
||||
long reval = 0;
|
||||
if (thisValue == null) return 0;
|
||||
if (thisValue is Enum)
|
||||
{
|
||||
return Convert.ToInt64(thisValue);
|
||||
}
|
||||
if (thisValue != null && thisValue != DBNull.Value && long.TryParse(thisValue.ToString(), out reval))
|
||||
{
|
||||
return reval;
|
||||
}
|
||||
return reval;
|
||||
}
|
||||
|
||||
public static int ObjToInt(this object thisValue, int errorValue)
|
||||
{
|
||||
int reval = 0;
|
||||
|
Reference in New Issue
Block a user