A: 

Wow, this is wierd. I've got this question both on Silverlight.net and StackOverflow and haven't gotten an answer. Is this an unanswerable question? Is there some flaw in having a EF Context in a disconnected client that makes it unusable for this kind of 'real-world' scenario? Or is my question too wordy and too boring to read .

I've been combing P&P for some guidance to see if I'm just approaching this incorrectly. I'm thinking might have to pass a DTO back to a more formal WCF service. That would seem to invalidate what Astoria's trying to do in terms of being a client side framework.

Any kind of feedback would be helpful.

Hi, thanks for the response. I couldn't fit my clarification into 500 characters so I wrote another 'Answer' ;-)
A: 

Realistically speaking I think you feel that you have to do the query Async because it takes too long? Is that assumption correct? If that is the case, you should examine what you are trying to do with the query itself. I always find that if I can write the SQL to get exactly the data I want then I can move forward with writing the LINQ to it (using something like LINQPad).

Additionally, you can also make a SQL view which "flattens" your complex graph. Then in EF update wizard make sure you select the view. That way everytime you are building this custom complex DTO you can just issue a server side where clause instead and populate your values there.

If I am way out in left field just let me know, I have extensive experience with EF in very complex business data object scenarios and I am more than likely reading your situation incorrectly.

I think people on SO were not answering because it was lengthy and they were hoping for a bounty, just a guess though.

jwendl
A: 

Thanks for your response. Yeah, it is a bit wordy. My ShortAndToThePoint() needs to be refactored :-). It also has a few bugs since I think I didn't get the issue across.

Where I'm stuck is that Silverlight, so far as I know, has no way to issue a query to the context in any other way besides Async.

As I mentioned:

What I'd like to do is:

var lev = ctx.SubjectLevelSet.Where(l => l.SubjectLevelId == subjectAndLevel.SubjectLevelId).FirstOrDefault(); if(lev == null ) lev = Helpers.MakeFakeSubjectLevelFor(ctx, subjectAndLevel);

but I get: "Specified method is not supported" which I assume means I have to do the query Async so I'm back to the same situation.

So, without the ability to issue a quick lookup for the entity (aka row) that represents "Elementary" in the Lookup.SubjectLevel table I'm forced to do an Async query, EVEN IF I HAVE IT IN THE LOCAL CONTEXT.