I have Users->Orders tables (one to many) and would like to select all users which have specified Orders. I have tried Linq below but it fails with error. How to write such Linq query?
DataAccess.Instance.Users.Where(p => p.Orders.Where(o => o.ProductId == productId))
You should try:
Note that the second
Whereis changed toAnywhich returns a boolean value and satisfies the type of the expression tree expected by the firstWhere:Whereneeds a condition, not a set of values retrieved from elsewhere.