public override QueryNode Visit(FunctionCallNode nodeIn) { this.Expression.Append(nodeIn.Name); this.Expression.Append("("); string separator = null; foreach (QueryNode arg in nodeIn.Arguments) { this.Expression.Append(separator); arg.Accept(this); separator = ","; } this.Expression.Append(")"); return(nodeIn); }
/// <summary> /// Process method calls which map one-to-one on an odata supported method. /// </summary> /// <param name="expression"> /// The expression to visit. /// </param> /// <param name="methodName"> /// The name of the method to look for. /// </param> /// <param name="isStatic"> /// Indicates if the method to look for is static. /// </param> /// <returns> /// The visited expression. /// </returns> private void VisitODataMethodCall(MethodCallExpression expression, string methodName, bool isStatic) { Debug.Assert(expression != null, "expression cannot be null!"); Debug.Assert(methodName != null, "methodName cannot be null!"); var fnCallNode = new FunctionCallNode(methodName, null); // adding node as a marker for start of arguments this.filterExpression.Push(fnCallNode); foreach (Expression argument in GetFilterMethodArguments(expression, methodName, isStatic)) { this.Visit(argument); } SetChildren(fnCallNode); }
/// <summary> /// Process member references. /// </summary> /// <param name="expression"> /// The expression to visit. /// </param> /// <returns> /// The visited expression. /// </returns> private Expression VisitMemberAccess(MemberExpression expression) { // Lookup the Mobile Services name of the member and use that string memberName = GetTableMemberName(expression, this.contractResolver); if (memberName != null) { this.filterExpression.Push(new MemberAccessNode(null, memberName)); return(expression); } // Check if this member is actually a function that looks like a // property (like string.Length, etc.) string methodName = null; MemberInfoKey memberInfoKey = new MemberInfoKey(expression.Member); if (InstanceProperties.TryGetValue(memberInfoKey, out methodName)) { var fnCallNode = new FunctionCallNode(methodName, null); this.filterExpression.Push(fnCallNode); this.Visit(expression.Expression); this.SetChildren(fnCallNode); return(expression); } // Otherwise we can't process the member. throw new NotSupportedException( string.Format( CultureInfo.InvariantCulture, "The member '{0}' is not supported in the 'Where' Mobile Services query expression '{1}'.", expression != null && expression.Member != null ? expression.Member.Name : null, expression != null ? expression.ToString() : null)); }
/// <summary> /// Visit an ODataMethodCallNode /// </summary> /// <param name="nodeIn">the node to visit</param> /// <returns>Defined by the implementer</returns> public virtual T Visit(FunctionCallNode nodeIn) { throw new NotImplementedException(); }