Ling with collection RRS feed

  • Question


    I have a customer collection that includes an orders property that is implemented as an interfaace.



    string Name

    List<IOrder> Orders


    I am return a list of customers and I am able to run this query



    var q = from c in  getCustomers

    select c.Customers;


    I want to query the orders


    var q = from c in  getCustomers

    select c.Customers.Orders;


    When I try to compile this is says that orders is not a property of Customers (It does show up with intellisense)




    Monday, March 24, 2008 8:35 PM


  • An individual Customer might have an Orders collection... but a Customer collection (Customers) doesn't automatically get a composite Orders collection... what exactly do you want it to do? Get all orders for all customers? You might need to union them together, or perhaps (if backed by a database) invert the query somehow.

    Monday, March 24, 2008 11:21 PM