I get an entity list by following:
var riscregions = db.RiscEntranceDetails.OrderBy(r => r.RiscEntranceID).Include(r => r.RiscEntrance).Include(r => r.RiscRegion);
However, I need to reach more deeply related entities attributes, such as:
<td>@item.RiscEntrance.ID</td>
<td>@item.RiscEntrance.Personnel.Name</td>
<td>@item.RiscEntrance.EntranceDateTime</td>
<td>@item.RiscEntrance.ShiftWork.ShiftGroup.TextID</td>
How can I reach those? Any suggestions including linq, or some other workarounds such as extensions and helpers are greatly appreciated.
You can do this:
You need to use
Selectin yourIncludeexpression only if you need to select children of a collection.