c# - Some clarity on LINQ/LAMBDA to retrieve data from an intersection table please? -
i have following entities:
order -< orderitem >- product
i need write linq retrieve order contains order items product id = 100.
so started along line of:
var order = order.where(r=>r.orderitems.productid == 100) ???
help required linq hugely appreciated.
many thanks.
var result = orders.where(o => o.orderitems.any(oi => oi.productid == 100));
Comments
Post a Comment