var customers = s.Query<Customer>() .Where(c => c.Orders.Any(o => orders.Contains(o))) .ToList();
You can also do it in one statement if you don't need the list of orders for something else: var customers = s.Query<Customer>() .Where(c => c.Orders.Any(o => ...)) .ToList(); On 1 Sep., 09:02, Giulio Petrucci <[email protected]> wrote: > Hi there, > > here is my domain objects: > > class Order { > Guid Id { ... } > ... > > } > > class Customer { > Guid Id { ... } > IList<Order> Orders { ... } > > } > > The scenario I'm dealing with right now is the following: > > ISession s = ...; > var orders = s.Query<Order>().Where(o => ...); > > so, I have some orders. > Here comes the question: how can I select all the Customer with > Customer.Orders containing at least one of the selected orders? > > Thanks in advance and have a nice day, > Giulio > > -- -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
