mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Synchronization Core
This commit is contained in:
@@ -158,7 +158,7 @@ namespace SqlSugar
|
||||
return reval;
|
||||
}
|
||||
|
||||
public static object DynamicInvoke(MemberExpression expression)
|
||||
public static object DynamicInvoke(Expression expression)
|
||||
{
|
||||
object value = Expression.Lambda(expression).Compile().DynamicInvoke();
|
||||
if (value != null && value.GetType().IsClass() && value.GetType() != ExpressionConst.StringType)
|
||||
|
@@ -14,8 +14,17 @@ namespace SqlSugar
|
||||
var express = base.Expression as MethodCallExpression;
|
||||
var isLeft = parameter.IsLeft;
|
||||
string methodName = express.Method.Name;
|
||||
var isValidNativeMethod = MethodMapping.ContainsKey(methodName)&&express.Method.DeclaringType.Namespace==("System");
|
||||
if (!isValidNativeMethod&&express.Method.DeclaringType.Namespace.IsIn("System.Linq", "System.Collections.Generic")&&methodName=="Contains") {
|
||||
if (methodName == "get_Item")
|
||||
{
|
||||
string paramterName = this.Context.SqlParameterKeyWord + ExpressionConst.Const + this.Context.ParameterIndex;
|
||||
this.Context.Parameters.Add(new SugarParameter(paramterName, ExpressionTool.DynamicInvoke(express)));
|
||||
this.Context.Result.Append(string.Format(" {0} ", paramterName));
|
||||
this.Context.ParameterIndex++;
|
||||
return;
|
||||
}
|
||||
var isValidNativeMethod = MethodMapping.ContainsKey(methodName) && express.Method.DeclaringType.Namespace == ("System");
|
||||
if (!isValidNativeMethod&&express.Method.DeclaringType.Namespace.IsIn("System.Linq", "System.Collections.Generic") && methodName == "Contains")
|
||||
{
|
||||
methodName = "ContainsArray";
|
||||
isValidNativeMethod = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user