Is this code at view really make lazy loading and each time it hits the database? And if it is, is there a solution, and how can I know that if it hit database or not?
@{ 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> } } and my controller code is :
public ViewResult Index() { var moduleItems = db.Albums.Include(x => x.AlbumsLocs).Where(a => a.AlbumVocId == id).ToList(); return View(moduleItems); }