Added support for invoking extension methods on native properties on DynamicNode where the native property type is string (e.g. NodeTypeAlias, Name). Half fixes ContainsAny support
This commit is contained in:
@@ -1474,6 +1474,10 @@ namespace System.Linq.Dynamic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == typeof(string))
|
||||
{
|
||||
|
||||
}
|
||||
switch (FindMethod(type, id, instance == null, args, out mb))
|
||||
{
|
||||
@@ -1488,6 +1492,16 @@ namespace System.Linq.Dynamic
|
||||
return CallMethodOnDynamicNode(instance, newArgs, instanceAsString, instanceExpression, (MethodInfo)mb, true);
|
||||
}
|
||||
}
|
||||
if (type == typeof(string) && instanceAsString == null && instance is MemberExpression)
|
||||
{
|
||||
Expression[] newArgs = (new List<Expression>() { instance }).Concat(args).ToArray();
|
||||
mb = ExtensionMethodFinder.FindExtensionMethod(typeof(string), newArgs, id, true);
|
||||
if (mb != null)
|
||||
{
|
||||
return Expression.Call(null, (MethodInfo)mb, newArgs);
|
||||
}
|
||||
}
|
||||
|
||||
throw ParseError(errorPos, Res.NoApplicableMethod,
|
||||
id, GetTypeName(type));
|
||||
case 1:
|
||||
|
||||
Reference in New Issue
Block a user