Hi raoof,
To me it seems you're actually only missing the "VisitGroupByClause" method, right? re-linq represents the GroupBy query operators as result operators (applied at the end of an ordinary query), which means that you should use the "VisitResultOperator" method to visit them.
E.g., consider the following query:
orders.GroupBy (o => o.Customer)
This will result in a QueryModel with one MainFromClause, one SelectClause and one GroupResultOperator. For the latter, the VisitResultOperator method will be visited once.
Regarding GroupBy in a MainFromClause, consider the following query:
orders.GroupBy (o => o.Customer).Select (g => g.Count())
This is equivalent to:
from g in (orders.GroupBy (o => o.Customer))
select g.Count()
Therefore, re-linq puts the "(orders.GroupBy (o => o.Customer))" part into a subquery. This means that the MainFromClause of the outer query contains a SubQueryExpression as its FromExpression. To deal with such subqueries, you need to override the "VisitSubQueryExpression" method in you expression visitor (or just check whether the FromExpression is a SubQueryExpression).
Best regards,
Fabian