I searched online for a long time, but I couldn't really get a straight answer to this. How would I use Include
to load a nested collection using Where
to filter it? Let's say, for instance, that I want to include all the CartItems
that are not disabled:
var myCart = _dbContext.Carts
.Include(cart => cart.CartShippingBoxes
.Select(cartShippingBox => cartShippingBox.CartItems
.Where(cartItem => !cartItem.IsDisabled))); // This doesn't work