-
Notifications
You must be signed in to change notification settings - Fork 934
Support MemberInit expression in group by #2221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks like making a small change on the "GroupBySelectClauseRewriter" class resolves the problem, but i don't know what problems can it cause: protected override Expression VisitMember(MemberExpression expression)
{
if (!IsMemberOfModel(expression))
{
return base.VisitMember(expression);
}
if (expression.IsGroupingKeyOf(_groupBy))
{
// If we have referenced the Key, then return the nominated key expression
return _nominatedKeySelector;
}
var elementSelector = _groupBy.ElementSelector;
if ((elementSelector is MemberExpression) || (elementSelector is QuerySourceReferenceExpression))
{
// If ElementSelector is MemberExpression, just return
return base.VisitMember(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();
} Change: throw new NotImplementedException(); To: return Expression.MakeMemberAccess(elementSelector, expression.Member); |
So... It's been 5 months... |
This is open-source and volunteer based work. You are welcome to contribute a PR, following contributing guidelines. |
I tried to add this line on the latest master and ended up with another error by executing odata request '/odata/tickets?$apply=groupby((priority))':
|
Execute this query gives the following exception:
The text was updated successfully, but these errors were encountered: