Solved

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

Posted on 2010-11-30
3
318 Views
Last Modified: 2012-05-10
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.
0
Comment
Question by:ichikuma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 21

Accepted Solution

by:
tovvenki earned 250 total points
ID: 34247917
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
 

Author Comment

by:ichikuma
ID: 34248281
Thanks Venki, I just found the issue, I wasn't handling the Complete on the LoadObject.

Thanks again for the suggestion.
0
 
LVL 5

Assisted Solution

by:KiasChaos83
KiasChaos83 earned 250 total points
ID: 35136232
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In previous Articles, we have discussed how we can upload a file using .asmx web service and isolated storage space. Here, in continuation to the topic, I am going to discuss how we can use WCF for the same purpose. Steps: 1.Create the silverli…
While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question