Loading Related Entities (ADO.NET Data Services) (Silverlight)?

I understand how to use ADO.NET Data Services to let's say load a ProductLine table that has a collection property of Products using a one to many mapping in the design layout.

Now my question is everywhere I look I have found 'lazy' loading examples of populating the Related Entity..say on a Tree Expand or Row Expand using the BeginLoadProperty method. My question is, how can I get these properties to load explicity so I only have to make that single call to the database? I am trying to do it without a LINQ query if possible.

For example, I tried this but it does not work

DataServiceQuery<serviceline> slinequery = result.AsyncState as DataServiceQuery<serviceline>;
                    var returnedServices = slinequery.EndExecute(result);
                    if (returnedServices != null)
                        foreach (serviceline sline in returnedServices)
                            db.BeginLoadProperty(sline, "services", OnServicesComplete, null); //HERE
    private void OnServicesComplete(IAsyncResult result)

Who is Participating?
melegant99Connect With a Mentor Author Commented:
Oh baby, I figured it out..and it is so easy.

In the query setup, just add expand!
 DataServiceQuery<serviceline> slinequery = db.serviceline.Expand("services");

Finally, something easy.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.