public static void ReWrite(QueryModel queryModel) { var subQueryExpression = queryModel.MainFromClause.FromExpression as SubQueryExpression; if ((subQueryExpression != null) && (subQueryExpression.QueryModel.ResultOperators.Count() == 1) && (subQueryExpression.QueryModel.ResultOperators[0] is GroupResultOperator) && (IsNonAggregatingGroupBy(queryModel))) { var rewriter = new NonAggregatingGroupByRewriter(); rewriter.FlattenSubQuery(subQueryExpression, queryModel.MainFromClause, queryModel); } }
public static void ReWrite(QueryModel queryModel) { if (queryModel.ResultOperators.Count == 1 && queryModel.ResultOperators[0] is GroupResultOperator && IsNonAggregatingGroupBy(queryModel)) { var resultOperator = (GroupResultOperator)queryModel.ResultOperators[0]; queryModel.ResultOperators.Clear(); queryModel.ResultOperators.Add(new NonAggregatingGroupBy(resultOperator)); return; } var subQueryExpression = queryModel.MainFromClause.FromExpression as SubQueryExpression; if ((subQueryExpression != null) && (subQueryExpression.QueryModel.ResultOperators.Count == 1) && (subQueryExpression.QueryModel.ResultOperators[0] is GroupResultOperator) && (IsNonAggregatingGroupBy(queryModel))) { var rewriter = new NonAggregatingGroupByRewriter(); rewriter.FlattenSubQuery(subQueryExpression, queryModel); } }