You need to implement the Get() method in the bookstore Web API application to be able to
find books by using an ad hoc query.
Which method should you use?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Explanation:
You need to implement the Get() method in the bookstore Web API application to be able to
find books by using an ad hoc query.
Which method should you use?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Explanation:
It must be B.
D will throw compile error.
A is already implemented in code(Application Structure).
“The RESTful API of the bookstore must expose the following endpoints
Get list of all book and get book by id”.
Between B and C.
“application to be able to find books by using an ad hoc query.”
http://stackoverflow.com/questions/252785/what-is-the-difference-between-iqueryablet-and-ienumerablet/25664959
According to upper article I thing that right answer is B – IQueryble
I can’t seem to understand why D has threw compile error, it worked fine for me. Besides, B will only get you a item not a list of items.
The question clearly states an Ad hoc Query, and according with this article:
http://stackoverflow.com/questions/3603545/ienumerablet-vs-ilistt-vs-iqueryablet
The correct answer is option D.
MNN copied and pasted a reply from http://www.aiotestking.com/microsoft/which-method-should-you-use-59/
d
+1
D – returns enough to be able to perform adhoc queries on the data. A and B are doing GetById, which is not what the question is asking for, and C returns IEnumerable which can’t be queried
D
ad hoc query = IQueryble
D++
The answer is D. The important hint is in the General Requirements section. It says: ” The BookApiController must have a method that is able to perform ad-hoc queries using OData”. And OData queries in ASP.NET is supported by having a method that returns an IQueryable.
https://docs.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/supporting-odata-query-options