Link to home
Start Free TrialLog in
Avatar of melegant99
melegant99

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of melegant99
melegant99

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial