W3 [Sitesearch]
New Member
New at linq to entities trying to figure this out. I have the following tables:Customer: Cust_Id, NameOrders: Order_IdCustomerOrders: Cust_Id, Order_IdI have a class like so:\[code\]public class Customers{public List<Row> Rows { get; set; }public Customers() { Rows = new List<Row>(); } public class Row { public int Key { get; set; } public string Name { get; set; } public List<string> Order_Ids { get; set; } }}\[/code\]Linq query is like this:\[code\]var query = from c in context.Customerselect new Customers.Row{ Key = c.Cust_Id, Name = c.Name, Order_IDs = List<string>( ?? )};foreach (var row in query){ Customers.Rows.Add(row);}var serializer = new JavaScriptSerializer();return serializer.Serialize(Customers);\[/code\]Where I have '??', can I use a subquery or something to get a list of Order_Id's from the CustomerOrders table?Right Now, I can only think to loop through the Customers table once it is filled and thenquery the DB again to get each array of Order Id's for each Customer.