protected override Expression VisitMemberExpression(MemberExpression expression) { if (!IsMemberOfModel(expression)) { return base.VisitMemberExpression(expression); } if (expression.IsGroupingKeyOf(_groupBy)) { return _groupBy.KeySelector; } var elementSelector = _groupBy.ElementSelector; if ((elementSelector is MemberExpression) || (elementSelector is QuerySourceReferenceExpression)) { // If ElementSelector is MemberExpression, just return return base.VisitMemberExpression(expression); } if ((elementSelector is NewExpression || elementSelector.NodeType == ExpressionType.Convert) && elementSelector.Type == expression.Expression.Type) { //TODO: probably we should check this with a visitor return Expression.MakeMemberAccess(elementSelector, expression.Member); } throw new NotImplementedException(); }
protected override Expression VisitMemberExpression(MemberExpression expression) { if (expression.IsGroupingKeyOf(_groupBy)) { return _groupBy.KeySelector; } return base.VisitMemberExpression(expression); }