EF Core 2 GroupBy Count predicate ignored
问题 I currently have the following code: var result = query<Items>() .Where(x => x.Id == someId) .SelectMany(x => x.SubItems) .GroupBy(x => x.SubItemId) .Select(x => new ItemModel { SubItemId = x.Key, SpecialItemCount = x.Where(y => y.IsSpecial == false).Count(), }) .ToList()... When I call "Count()" it queries all subitem count ignoring my predicate "y.IsSpecial". I tried that on EF Core 2.0.X and EF Core 2.1 preview 2, is that possibly a bug? 回答1: You need to upgrade to EF Core 2.1 where