public ApplyClause BindApply(IEnumerable <QueryToken> tokens) { ExceptionUtils.CheckArgumentNotNull(tokens, "tokens"); var transformations = new List <TransformationNode>(); foreach (var token in tokens) { switch (token.Kind) { case QueryTokenKind.Aggregate: var aggregate = BindAggregateToken((AggregateToken)(token)); transformations.Add(aggregate); aggregateExpressionsCache = aggregate.Expressions; state.AggregatedPropertyNames = aggregate.Expressions.Select(statement => statement.Alias).ToList(); break; case QueryTokenKind.AggregateGroupBy: var groupBy = BindGroupByToken((GroupByToken)(token)); transformations.Add(groupBy); break; default: var filterClause = this.filterBinder.BindFilter(token); var filterNode = new FilterTransformationNode(filterClause); transformations.Add(filterNode); break; } } return(new ApplyClause(transformations)); }
public ApplyClause BindApply(IEnumerable <QueryToken> tokens) { ExceptionUtils.CheckArgumentNotNull(tokens, "tokens"); List <TransformationNode> transformations = new List <TransformationNode>(); foreach (QueryToken token in tokens) { switch (token.Kind) { case QueryTokenKind.Aggregate: AggregateTransformationNode aggregate = BindAggregateToken((AggregateToken)(token)); transformations.Add(aggregate); aggregateExpressionsCache = aggregate.AggregateExpressions; state.AggregatedPropertyNames = new HashSet <EndPathToken>(aggregate.AggregateExpressions.Select(statement => new EndPathToken(statement.Alias, null))); state.IsCollapsed = true; break; case QueryTokenKind.AggregateGroupBy: GroupByTransformationNode groupBy = BindGroupByToken((GroupByToken)(token)); transformations.Add(groupBy); state.IsCollapsed = true; break; case QueryTokenKind.Compute: var compute = BindComputeToken((ComputeToken)token); transformations.Add(compute); state.AggregatedPropertyNames = new HashSet <EndPathToken>(compute.Expressions.Select(statement => new EndPathToken(statement.Alias, null))); break; case QueryTokenKind.Expand: SelectExpandClause expandClause = SelectExpandSemanticBinder.Bind(this.odataPathInfo, (ExpandToken)token, null, this.configuration, null); ExpandTransformationNode expandNode = new ExpandTransformationNode(expandClause); transformations.Add(expandNode); break; default: FilterClause filterClause = this.filterBinder.BindFilter(token); FilterTransformationNode filterNode = new FilterTransformationNode(filterClause); transformations.Add(filterNode); break; } } return(new ApplyClause(transformations)); }