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

Hi,
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>;
                try
                {
                    var returnedServices = slinequery.EndExecute(result);
                   
                    if (returnedServices != null)
                    {
                        foreach (serviceline sline in returnedServices)
                        {
                            db.BeginLoadProperty(sline, "services", OnServicesComplete, null); //HERE
                            ServiceLine.Add(sline);                      
                        }....
    private void OnServicesComplete(IAsyncResult result)
        {
            db.EndLoadProperty(result);
        }




Thanks.
melegant99Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

melegant99Author 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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.