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:
brandon
2026-08-08 15:20:39 -04:00
parent 10d108a1f4
commit 505a6ebf8f
@@ -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();