Which code segment should you use?

You are developing an order processing application that uses the ADO.NET Entity
Framework against a SQL Server database. Lazy loading has been disabled. The
application displays orders and their associated order details. Order details are filtered
based on the category of the product in each order.
The Order class is shown below.

The OrderDetail class is shown below.

The Product class is shown below.

The Category class is shown below.

You need to return orders with their filtered list of order details included in a single round
trip to the database. Which code segment should you use?

You are developing an order processing application that uses the ADO.NET Entity
Framework against a SQL Server database. Lazy loading has been disabled. The
application displays orders and their associated order details. Order details are filtered
based on the category of the product in each order.
The Order class is shown below.

The OrderDetail class is shown below.

The Product class is shown below.

The Category class is shown below.

You need to return orders with their filtered list of order details included in a single round
trip to the database. Which code segment should you use?

A.
Option A

B.
Option B

C.
Option C

D.
Option D



Leave a Reply 4

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


FigArt

FigArt

B – materializes the orders to a list (to prevent round tripping)

Peter Vogel

Peter Vogel

Actually, none of them work because all of them return the orders with all of their order details. As I read the question, only the order details with the right category of product are to be returned.