my question now : is this code at view realy make lazy loading and each time it hit the database ??
@{
int langId = ViewBag.LangId;
int i = 0;
foreach (var item in Model)
{
i++;
<tr class="@(i % 2 == 0 ? "even" : "odd")">
<td>
@Html.DisplayFor(modelItem => item.AlbumsLocs.FirstOrDefault(b => b.LanguageId == langId).Title)
</td>
</tr>
}
}
my controller code :
public ViewResult Index()
{
var moduleItems = db.Albums.Include(x => x.AlbumsLocs).Where(a => a.AlbumVocId == id).ToList();
return View(moduleItems);
}