1. Customers,2. Orders per customer and,3. Details per order. Code would look like this...
private void Page_Loaded(object sender, RoutedEventArgs e) { NorthwindContext ctx = new NorthwindContext(); dataGrid1.ItemsSource = ctx.Customers; ctx.Load(ctx.GetCustomersQuery()); //What additional code would you add two support two additinal xamgrids? }
private void Page_Loaded(object sender, RoutedEventArgs e) {
{
NorthwindContext ctx = new NorthwindContext();
dataGrid1.ItemsSource = ctx.Customers; ctx.Load(ctx.GetCustomersQuery()); //What additional code would you add two support two additinal xamgrids? }
ctx.Load(ctx.GetCustomersQuery());
//What additional code would you add two support two additinal xamgrids?
}
You can use the Include method in your LINQ query:
var customers = from o in cdx.Customers.Include("Orders") select o;
This tells LINQ to include the Orders in its result, and you can chain multiple Include methods.
See http://msdn.microsoft.com/en-us/library/bb738708.aspx for more info.
One word of caution, when using the Include method, its pretty easy to balloon the number of objects included in the query. If your planning to return the result of the query via web service, you might start running up against the WCF message size limits.
Devin