views:

123

answers:

1

I had a connection working but something changed and now the data isn't showing up. It is a simple query that worked before that just returns all entities. I put in break points on the LoadOperation call and it fires and gets 0 entities. I also put a break point on the service itself, and it does not break before the LoadOperation evaluates. After the LoadOperation completes, then the service query is called... well after we needed the data. The only thing that I can think of that could be a problem is that I added 2 WCF services to the solution. Would WCF services stop the RIA from working? Any ideas on what else could cause the problem?

Client:

LoadOperation<Project> loadOp =
                this._projectContext.Load(this._projectContext.GetProjectsQuery());

Service:

public IQueryable<Project> GetProjects()
{
    return this.Context.Projects;
}

See, real basic, but not working.

+1  A: 

You need to put a callback method on your Load operation and then check the results of the LoadOperation.Error when it comes back. In that error you will find the exception which will let you know what the problem is (you will probably have to check the inner exception to get the full details).

Bryant
If i use the callback, then it does return the entities. Sup with that?
Eric P
Load is an asynchronous operation. So when you're calling Load the objects aren't there even when it returns. Once the callback is fired then the objects will be there.
Bryant
Yea, i started seeing that, im just curious on how it was working before. I saw the data populate in my silverlight app without a call back.
Eric P
Could be that the calls were happening fast enough that you didn't notice. That would be my only explanation.
Bryant
That's not it. You don't have to use callbacks to load the itemssource/datacontext. It's an observable collection so that is the magic behind it. However, if there's an error you do need the callback to check the error returned.
vidalsasoon