Browse Source

Update exp to sql

SqlSugar5
sunkaixuan 2 years ago
parent
commit
cad0b8955a
  1. 18
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs

18
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs

@ -775,6 +775,10 @@ namespace SqlSugar
{
type = DbType.MySql;
}
else
{
type = GetType(this.Context.GetType().Name);
}
return this.Context.SqlFuncServices.First(it => it.UniqueMethodName == name).MethodValue(model, type, this.Context);
}
else
@ -1021,6 +1025,20 @@ namespace SqlSugar
return null;
}
private DbType GetType(string name)
{
DbType result = DbType.SqlServer;
foreach (var item in UtilMethods.EnumToDictionary<DbType>())
{
if (name.StartsWith(item.Value.ToString()))
{
result = item.Value;
break;
}
}
return result;
}
private bool IsContainsArray(MethodCallExpression express, string methodName, bool isValidNativeMethod)
{
return !isValidNativeMethod && express.Method.DeclaringType.Namespace.IsIn("System.Linq", "System.Collections.Generic") && methodName == "Contains";

Loading…
Cancel
Save