I am trying to query a single entity in a database with a DataServiceQuery. The entity I am trying to load has relations to a graph of other entities that I want to load as well. MSDN describes here and here that I can load my referred entities using either DataServiceQuery<TElement>.Expand or DataServiceContext.LoadProperty.
This works fine for first degree relations of my entity, but I have a problem loading relations of relations.
Obviously I could call LoadProperty for all second degree relations and loop through all second degree collections, but I was hoping that I could eager load the whole relation graph in a single query. Is that possible?
Edit
Actually loading the second degree relations is not that obvious after all. The following code fails (domain model changed for clarity):
var context = DataServiceReference.DataServiceContextFactory.Create();
var customer = (from c in context.Customers.Expand("Orders")
where c.CustomerId.Equals(customerId)
select c).First();
foreach (var order in customer.Orders)
{
context.LoadProperty(order, "Products");
The last line above throws InvalidOperationException: "The context is not currently tracking the entity.". I use self-tracking-entities. Could this error be related to STE?
How would I load second degree relations in any way?
Solution edit
It turns out that DataServiceQuery<TElement>.Expand uses a different path syntax compared to ObjectQuery<T>.Include. The former uses slash as path separator the latter uses dot. Can anyone explain why the syntax is inconsistent and where I can find documentation of the Expand path syntax?