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:
agrath@gmail.com
2011-07-21 11:25:15 -12:00
parent f6eb9c77a9
commit e8a941fc1f

View File

@@ -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: