Skip to content

Commit eb011e9

Browse files
committed
NH-3800 - Modifed the GroupBySelectClauseRewriter to allow member access of convert expressions
* This allows the group element selector be cast to the expected type, simplifying the select clause.
1 parent a33e267 commit eb011e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/NHibernate/Linq/GroupBy/GroupBySelectClauseRewriter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ protected override Expression VisitMemberExpression(MemberExpression expression)
5959
return base.VisitMemberExpression(expression);
6060
}
6161

62-
if (elementSelector is NewExpression && elementSelector.Type == expression.Expression.Type)
62+
if ((elementSelector is NewExpression || elementSelector.NodeType == ExpressionType.Convert)
63+
&& elementSelector.Type == expression.Expression.Type)
6364
{
6465
//TODO: probably we should check this with a visitor
6566
return Expression.MakeMemberAccess(elementSelector, expression.Member);

0 commit comments

Comments
 (0)