Out of ideas, need help getting data back from a RIA Domain Service

New to RIA Domain Services and everthing I've found so far says it should work but I can't get it to work and was hoping for some guidance.

I have a Database entity and a Domain Service tied to it.  If I drag a grid onto my web page and associate an entity, it populates the grid fine.  If in my Domain Service (I created a custom method that does a join) it doesn't return data (even though it does in a separate c# windows app).  

Custom Domain Service Method w/joins:
public IQueryable<Time> GetTimeWithAppointments()
{
    try
    {
        var query = from t in this.ObjectContext.Times
                    join a in this.ObjectContext.Appointments on t.ID equals a.TimeID into times
                    from a in times.Where(item => item.TimeID == t.ID).DefaultIfEmpty()
                    join c in this.ObjectContext.ClientInfos on a.ClientID equals c.ID into clients
                    from c in clients.Where(client => client.ID == a.ClientID).DefaultIfEmpty()
                    select new { t.Time1, a.Subject, c.FirstName, c.LastName };

        return query as ObjectQuery<Time>;
    }
    catch (Exception ex)
    {
        return null;
    }
}

If I change the above return code it will return just fine and populate the grid:
return this.ObjectContext.Appointments;

And the strange thing is, the Domain Service NEVER returns anything when called like this:
SchedulingDomainContext context = new SchedulingDomainContext();

var query = from a in context.GetTimeWithAppointmentsByDateQuery()
            where a.Subject != null
            select a;

var loadOperation = context.Load<Web.Appointment>(query, MyCallBack, null);//context.GetAppointmentsQuery());
loadOperation.Completed += new EventHandler(loadOption_Completed);

foreach (Web.Appointment appt in context.Appointments)
{
    int x = 6;
}

And neither of the callbacks get called.  I must be forgetting something, I'm totally confused.  If some other code is needed please let me know.  I've been banging my head against the wall for a day now.
ichikumaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
tovvenkiConnect With a Mentor Commented:
Hi,
Check in your silverlight client whether are you using the proper domaincontext. I have faced similar issue in not getting the data to be deleted by calling the delete and in the end I found that it was because of using a wrong domaincontext.

Thanks and regards,
Venki
0
 
ichikumaAuthor Commented:
Thanks Venki, I just found the issue, I wasn't handling the Complete on the LoadObject.

Thanks again for the suggestion.
0
 
KiasChaos83Connect With a Mentor Commented:
Ichikuma, what you've stated gives me the impression that you're not using databinding to its full potential. There are a lot of great databinding features in Silverlight. If your DomainContext does a query and hence updates any of its Entities internally, it will trigger all controls that are databound to the list.

If you haven't databound the controls (including the window/childwindow) then you're missing out. If you have databound the controls and it's not updating then you need to ensure that you are keeping the list in an array type that implements INotifyChanged.
0
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.