Skip to content

Commit 38c82fd

Browse files
committed
Merge branch 'NH-3743'
Closes #398
2 parents bc9939b + f2fe883 commit 38c82fd

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/NHibernate.Test/Linq/ByMethod/GroupByTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,19 @@ public void GroupByOrderByKeySelectToClass()
810810
}
811811

812812

813+
[Test(Description = "NH-3743")]
814+
public void FetchBeforeGroupBy()
815+
{
816+
var result = db.Orders
817+
.Fetch(x => x.Customer)
818+
.GroupBy(x => x.Customer.CompanyName)
819+
.OrderBy(x => x.Key)
820+
.Select(x => new { P0 = x.Key, P1 = x.Count() })
821+
.ToArray();
822+
823+
Assert.True(result.Any());
824+
}
825+
813826
private class GroupInfo
814827
{
815828
public object Key { get; set; }

src/NHibernate/Linq/ReWriters/QueryReferenceExpressionFlattener.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Remotion.Linq;
55
using Remotion.Linq.Clauses;
66
using Remotion.Linq.Clauses.Expressions;
7+
using Remotion.Linq.EagerFetching;
78
using Remotion.Linq.Parsing;
89

910
namespace NHibernate.Linq.ReWriters
@@ -16,6 +17,8 @@ public class QueryReferenceExpressionFlattener : ExpressionTreeVisitor
1617
{
1718
typeof (CacheableResultOperator),
1819
typeof (TimeoutResultOperator),
20+
typeof (FetchOneRequest),
21+
typeof (FetchManyRequest)
1922
};
2023

2124
private QueryReferenceExpressionFlattener(QueryModel model)

0 commit comments

Comments
 (0)