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 all orders along with customer information. Lazy
loading has been disabled. The Order class is shown below.

You need to return the orders and customer information in a single round trip to the
database. 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 all orders along with customer information. Lazy
loading has been disabled. The Order class is shown below.

You need to return the orders and customer information in a single round trip to the
database. Which code segment should you use?

A.

B.

C.

D.



Leave a Reply 6

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


response

response

impossible men sorry. ya que este maneja un metodo de entidad de relacion que permite llamar al servidor de mi base de datos trayendo la informacion de la entidad especificada y cargandola dentro de mi clase a su propiedad de navegacion. obteniendo la informacion de mi Order mas la informacion del cliente

Miroslav Holec

Miroslav Holec

Answer is A. The requirement is “You need to return the orders and customer information in a single round trip to the database.” That means you want to rise just 1 SQL query (JOIN).

C – wrong, because of explicit loading (multiple queries)
B – wrong, because of bad include path
D – wrong, because the lazy loading is disabled and related entity is not loaded

Will

Will

Here’s a great article that explains lazy loading, eager loading, and explicit loading in the Entity Framework.
https://msdn.microsoft.com/en-us/data/jj574232.aspx

Eager loading is the process whereby a query for one type of entity also loads related entities as part of the query. Eager loading is achieved by use of the Include method.