Use WhereOneOrMany helper for the alternate version id filter
Filter the parent ids with the WhereOneOrMany query helper instead of a raw Contains so the id list is wrapped in EF.Parameter and EF Core reuses one compiled query plan across calls, matching how the rest of the item queries build their id filters.
This commit is contained in:
@@ -70,9 +70,9 @@ public class LinkedChildrenService : ILinkedChildrenService
|
||||
using var dbContext = _dbProvider.CreateDbContext();
|
||||
|
||||
return dbContext.LinkedChildren
|
||||
.Where(lc => (lc.ChildType == DbLinkedChildType.LocalAlternateVersion
|
||||
|| lc.ChildType == DbLinkedChildType.LinkedAlternateVersion)
|
||||
&& itemIds.Contains(lc.ParentId))
|
||||
.Where(lc => lc.ChildType == DbLinkedChildType.LocalAlternateVersion
|
||||
|| lc.ChildType == DbLinkedChildType.LinkedAlternateVersion)
|
||||
.WhereOneOrMany(itemIds as IList<Guid> ?? itemIds.ToList(), lc => lc.ParentId)
|
||||
.Select(lc => lc.ParentId)
|
||||
.Distinct()
|
||||
.ToHashSet();
|
||||
|
||||
Reference in New Issue
Block a user