Which code segment should you use?

You are developing an ASP.NET MVC application. The application is an order processing system that uses
the ADO.NET Entity Framework against a SQL Server database. It has a controller that loads a page that
displays customers. Customers are filtered on Country and, if provided, on CompanyName.
You have an Entity Framework context named db.
The Customer class is shown below.

You need to execute a single deferred query to return the filtered list of customers.
Which code segment should you use?

You are developing an ASP.NET MVC application. The application is an order processing system that uses
the ADO.NET Entity Framework against a SQL Server database. It has a controller that loads a page that
displays customers. Customers are filtered on Country and, if provided, on CompanyName.
You have an Entity Framework context named db.
The Customer class is shown below.

You need to execute a single deferred query to return the filtered list of customers.
Which code segment should you use?

A.
Option A

B.
Option B

C.
Option C

D.
Option D



Leave a Reply 7

Your email address will not be published. Required fields are marked *


Help

Help

Hi,
In none of the code snips is de customers variable initialized with data when “compagnyName” is empty or am I wrong? So why is option C correct?

nex-54

nex-54

yep, customers variable not initialized

nex-54

nex-54

Do we need queary.Load()?
Looks like we can not do this step.

Tsessebe

Tsessebe

IQueryable does not have a Load() method.

The answer is A

Sorryb

Sorryb

A, C and D run ! But a single defered query we have only at A.

“IEnumerable has immediate execution, whereas IQueryable has deferred execution or lazy loading”