LINQ in Action roller

DataLoadOptions - prefetch via a prefetched entity

Hi, Sometimes I need a data like below: NorthwindDataContext db = new NorthwindDataContext(); DataLoadOptions loadOptions = new DataLoadOptions(); loadOptions.LoadWith(c => c.Orders); loadOptions.LoadWith(o => o.OrderDetails); db.LoadOptions = loadOptions; foreach (Customer item in db.Customers) { // needed data. Console.WriteLine(item.ContactName +" Order Count"+item.Orders.Count+" "+ item.Orders[0].Order_Details.Count()); } What is happeng here is that Orders are prefetched with customer. But, Read More...
Published Thursday, July 31, 2008 1:25 AM by MSDN Forums: LINQ Project General
Anonymous comments are disabled

Featured Item

This Blog

Sponsoring

Syndication