I\'m doing the mvcmusicstore practice tutorial. I noticed something when creating the scaffold for the album manager (add delete edit).
I want to write code elegantl
You can use Include() first, then retrieve a single object from the resulting query:
Include()
Item item = db.Items .Include(i => i.Category) .Include(i => i.Brand) .FirstOrDefault(x => x.ItemId == id);