From 353d7fa0e2733def94e73c3e73dd57b13c4a50a1 Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Fri, 3 Mar 2023 14:20:02 +0100 Subject: [PATCH] [PM-1191] fix: use join instead of select-subquery EF6 is currently not able to translate LINQ that include selects after groupby statements. Using join let's us bypass this issue. --- .../Repositories/CollectionRepository.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Infrastructure.EntityFramework/Repositories/CollectionRepository.cs b/src/Infrastructure.EntityFramework/Repositories/CollectionRepository.cs index 755e69264d..ce5b07b1c0 100644 --- a/src/Infrastructure.EntityFramework/Repositories/CollectionRepository.cs +++ b/src/Infrastructure.EntityFramework/Repositories/CollectionRepository.cs @@ -186,13 +186,13 @@ public class CollectionRepository : Repository c.Id).Contains(cg.Collection.Id) + from c in collections + join cg in dbContext.CollectionGroups on c.Id equals cg.CollectionId group cg by cg.CollectionId into g select g; var users = - from cu in dbContext.CollectionUsers - where cu.Collection.OrganizationId == organizationId - && collections.Select(c => c.Id).Contains(cu.Collection.Id) + from c in collections + join cu in dbContext.CollectionUsers on c.Id equals cu.CollectionId group cu by cu.CollectionId into u select u; - return collections.Select(collection => new Tuple( collection,