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();
La correcta es la D? porque la A no es correcta. Pienso que no hay informaciĆ³n suficiente para decidir entre una o otra.
I agree; it’s not clear. But perhaps there’s a clue in that both B & C mention Color, not Colors.
The Database table will be called “Color” and the method generated to get the list of entries will be ‘pluralized’ to “Colors”
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).
http://blogs.msdn.com/b/adonet/archive/2011/01/31/using-dbcontext-in-ef-feature-ctp5-part-6-loading-related-entities.aspx