mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 01:58:13 +08:00
Soupport Int.Parse
This commit is contained in:
@@ -402,6 +402,14 @@ namespace SqlSugar
|
||||
}
|
||||
else
|
||||
{
|
||||
if (name == "Parse" && TempParseType.IsIn(UtilConstants.GuidType))
|
||||
{
|
||||
name = "Equals";
|
||||
}
|
||||
else if(name== "Parse")
|
||||
{
|
||||
name = "To"+TempParseType.Name;
|
||||
}
|
||||
switch (name)
|
||||
{
|
||||
case "IIF":
|
||||
@@ -526,10 +534,30 @@ namespace SqlSugar
|
||||
{
|
||||
if (IsExtMethod(expression.Method.Name))
|
||||
return true;
|
||||
if (IsParseMethod(expression))
|
||||
return true;
|
||||
if (expression.Method.ReflectedType().FullName != ExpressionConst.SqlFuncFullName)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
private Type TempParseType;
|
||||
public bool IsParseMethod(MethodCallExpression expression)
|
||||
{
|
||||
if (expression.Method.Name == "Parse"&&expression.Method.DeclaringType.IsIn(
|
||||
UtilConstants.DecType,
|
||||
UtilConstants.DateType,
|
||||
UtilConstants.DobType,
|
||||
UtilConstants.GuidType,
|
||||
UtilConstants.FloatType,
|
||||
UtilConstants.ShortType,
|
||||
UtilConstants.LongType,
|
||||
UtilConstants.IntType))
|
||||
{
|
||||
TempParseType = expression.Method.DeclaringType;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user