HI Ian, Here is an idea:
Say you have some customers EntityCollection filled, and somehow you fill the TreeView with that data:
// obtaining the customer collection
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
LinqMetaData metaData = new LinqMetaData(adapter);
var q = from c in metaData.Customers
select c;
customers = ((ILLBLGenProQuery)q).Execute<EntityCollection<CustomersEntity>>();
// fill the tree...
}
Then you "somehow" detect the click on some node and you obtain the selected entiry, then you could fill the next level:
// selectedCustomer = ObtainSelectedEntityFromTree();
// fetch the orders of the selected customer
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
LinqMetaData metaData = new LinqMetaData(adapter);
var q = from o in metaData.Orders
where o.CustomerId == selectedCustomer.CustomerId
select o;
selectedCustomer.Orders.AddRange( ((ILLBLGenProQuery)q).Execute<EntityCollection<OrdersEntity>>() );
}
At this point, customers[0].Orders is filled. You can do the same for the subsequent levels of the tree.