PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are developing a library management application that uses the ADO.NET Entity Framework against a SQL
Server database. The application has a method that returns check outs filtered by date.
The Book class is shown below.

You must filter the data on the SQL server before it is returned to the application server.
You need to return books checked out more recently than the entered date.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
The difference is that IQueryable<T> is the interface that allows LINQ-to-SQL (LINQ.-to-anything really) to
work. So if you further refine your query on an IQueryable<T>, that query will be executed in the database, if
possible.
For the IEnumerable<T> case, it will be LINQ-to-object, meaning that all objects matching the original query will
have to be loaded into memory from the database.

One Comment on “Which code segment should you use?


Leave a Reply