How can I write a LINQ query that returns an hierachical anonymous type from a Join?
To clarify what I mean: With WCF Data Services and Telerik WPF RadTreeView one can easily query and display hierarchical data:
Dim q = _ctx1.Execute(Of NorthwindDataService.Customers)(New Uri("Customers\?$expand=Orders", UriKind.Relative))
Dim td As New GridViewTableDefinition
td.Relation = New Telerik.Windows.Data.PropertyRelation("Orders")
RadGridView1.ChildTableDefinitions.Add(td)
Dim r = q.ToList
RadGridView1.ItemsSource = r
I want to join entities from different Data Services and display them in a hierachical grid.
Dim q = From c In _ctx1.Customers.ToList
Join o In _ctx2.Orders.ToList On c.CustomerID Equals o.CustomerID
Select New With {c.CustomerID,
o.OrderId
}
The join works. How can I "Select" an anonymous type with all properties of Customer plus an Orders property, analogous to what a data service returns, that does directly bind to the grid?
Something like (this is not supported syntax!): Select New With {c.*, .Orders = o }