Deferred execution – lazy loading versus eager loading
In one of the preceding examples, we retrieved the category name of a product using the following expression:
p.Category.CategoryName == "Beverages"
Even though there is no field called categoryname
in the Products
table, we can still get the category name of a product because there is an association between the Products
and Category
tables. In the Northwind.edmx design pane, click on the line that connects the Products and Categories tables and you will see all of the properties of the association. Note that its Referential Constraint
property is Category.CategoryID -> Product.CategoryID
, meaning that category ID
is the key field to link these two tables.
Because of this association, we can ...
Get WCF Multi-layer Services Development with Entity Framework Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.