You are developing an application in Visual Studio 2012 to display student information. The application
contains the following Entity Framework model.
The application contains a WCF data service named DirectoryService.svc.
You need to create a query expression to display all of the grades for students whose first name is
“John”
How should you build the expression?
A.
http://localhost:54946/DirectoryService.svc/Students?$filter=FirstName eq ‘John’ &$expand=Grades
B.
http://localhost:54946/DirectoryService.svc/Students?$filter=FirstName eq ‘John’/Grades
C.
http://localhost:54946/DirectoryService.svc/Students?$filter=FirstName = ‘John’ &$expand=Grades
D.
http://localhost:54946/DirectoryService.svc/Grades/Students?$filter=FirstName eq ‘John’
C
No, A
Why A?
I think D.
Quote from ‘Ryan W. Exam Ref 70-487’:
“As long as there are relationships defined in the Entity Model, you can use a few different semantics to return related entities.
…
Change things up and assume (just for review) that you want to return the Question entity with a key value of “1” and you want just the QuestionText property:
http://servicehost/ExamPrepService.svc/Questions('1‘)/QuestionText
That would give you the Question text, but what if you wanted the Answers to it? You would use:
http://servicehost/ExamPrepService.svc/Questions('1‘)/Answers
You can work it the other way around, too, of course. If you want the Question that corresponded to an Answer entity with a key of (‘1:4’):
http://servicehost/ExamPrepService.svc/Answers('1:4‘)/Question”
D will return Students, while we need Grades.
So I think that A is correct.