/// <summary> /// Initializes an instance of <see cref="ConvertNode"/> /// </summary> /// <param name="source">The node to convert.</param> /// <param name="targetType">The type to convert the node to</param> public ConvertNode(QueryNode source, Type targetType) { this.Source = source; this.TargetType = targetType; }
/// <summary> /// Initializes instance of <see cref="BinaryOperatorNode"/> /// </summary> /// <param name="kind">The kind of this node.</param> /// <param name="left">The left operand.</param> /// <param name="right">The right operand.</param> public BinaryOperatorNode(BinaryOperatorKind kind, QueryNode left, QueryNode right) { this.OperatorKind = kind; this.LeftOperand = left; this.RightOperand = right; }
/// <summary> /// Initializes an instance of <see cref="OrderByNode"/> /// </summary> /// <param name="expression">The order-by expression.</param> /// <param name="direction">The direction to order.</param> public OrderByNode(QueryNode expression, OrderByDirection direction) { this.Expression = expression; this.Direction = direction; }
private static MobileServiceTableQueryDescription Parse(string tableName, string query, string uriPath) { bool includeTotalCount = false; int? top = null; int? skip = null; string[] selection = null; QueryNode filter = null; IList <OrderByNode> orderings = null; IDictionary <string, string> parameters = HttpUtility.ParseQueryString(query); foreach (KeyValuePair <string, string> parameter in parameters) { string key = parameter.Key; string value = parameter.Value; if (String.IsNullOrEmpty(key)) { continue; } switch (key) { case ODataOptions.Filter: filter = ODataExpressionParser.ParseFilter(value); break; case ODataOptions.OrderBy: orderings = ODataExpressionParser.ParseOrderBy(value); break; case ODataOptions.Skip: skip = Int32.Parse(value); break; case ODataOptions.Top: top = Int32.Parse(value); break; case ODataOptions.Select: selection = value.Split(','); break; case ODataOptions.InlineCount: includeTotalCount = "allpages".Equals(value); break; default: throw new ArgumentException($"Unrecognized query parameter '{key}'.", nameof(query)); } } var description = new MobileServiceTableQueryDescription(tableName) { IncludeTotalCount = includeTotalCount, Skip = skip, Top = top }; description.UriPath = uriPath; if (selection != null) { ((List <string>)description.Selection).AddRange(selection); } if (orderings != null) { ((List <OrderByNode>)description.Ordering).AddRange(orderings); } description.Filter = filter; return(description); }