Which code segment should you use?

A performance issue exists in the application. The following code segment is causing a performance bottleneck:

var colors = context.Parts.GetColors();

You need to improve application performance by reducing the number of database calls. Which code segment should you use?

A performance issue exists in the application. The following code segment is causing a performance bottleneck:

var colors = context.Parts.GetColors();

You need to improve application performance by reducing the number of database calls. Which code segment should you use?

A.
var colors = context.Parts.OfType<Product>().Include(“Colors”).GetColors();

B.
var colors = context.Parts.OfType<Product>().Include(“Product.Color”).GetColors();

C.
var colors = context.Parts.OfType<Product>().Include(“Parts.Color”).GetColors();

D.
var colors = context.Parts.OfType<Product>().Include(“Color”).GetColors();



Leave a Reply 5

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


Javier

Javier

La correcta es la D? porque la A no es correcta. Pienso que no hay informaciĆ³n suficiente para decidir entre una o otra.

Mike

Mike

I agree; it’s not clear. But perhaps there’s a clue in that both B & C mention Color, not Colors.

E

E

The Database table will be called “Color” and the method generated to get the list of entries will be ‘pluralized’ to “Colors”

Gaius

Gaius

The navigation property will be Color, since each product will have only one color mapped to it. This is clear when you see the question in context (part of a case study).