public Expression Generate(Function method, IEnumerable<Expression> arguments) { var instance = arguments.First(); var args = arguments.Skip(1); var methodName = method.GetDotNetMethodName(); return Expression.Call(instance, methodName, new Type[0], args.ToArray()); }
public Expression Generate(Function method, IEnumerable<Expression> arguments) { var instance = arguments.First(); var propertyName = method.GetDotNetMethodName(); var propertyInfo = instance.Type.GetProperty(propertyName); if (propertyInfo == null) { throw new NotSupportedException(String.Format("Method '{0}' not supported for type '{1}'.", method.GetODataQueryMethodName(), instance.Type)); } return Expression.MakeMemberAccess(instance, propertyInfo); }
public Expression Generate(Function method, IEnumerable<Expression> arguments) { var methodName = method.GetDotNetMethodName(); return Expression.Call(typeof (Math), methodName, new Type[0], arguments.ToArray()); }