title: ForeignKey navigation property value not showing up in Details and Delete Views
body: <p>I have two models <code>Project</code> and <code>Category</code> where each project contains multiple categories.</p>
  
  <p>Project.cs</p>
  
  <pre><code>public class Project
  {
      public int Id { get; set; }
  
      [Required]
      [Display(Name="Project Name")]
      public string Name { get; set; }
  
      public ICollection&lt;Category&gt; Categories { get; set; }
  }
  </code></pre>
  
  <p>Category.cs</p>
  
  <pre><code>public class Category
  {
      public int Id { get; set; }
  
      [Required]
      [Display(Name="Category Name")]
      public string Name { get; set; }
  
      [Required]
      [ForeignKey("Project")]
      public int ProjectId { get; set; }
  
      public Project Project { get; set; }
  }
  </code></pre>
  
  <p>After scaffolding when I click on <code>Details</code> or <code>Delete</code> (after adding some projects and categories) link for a category, the project name does not show up in both the views! Only the label shows up. It shows up in <code>Index</code> and <code>Edit</code> views though. What could be the reason for that?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>This is <code>Details</code> action</p>
  
  <pre><code>    public ActionResult Details(int? id)
      {
          if (id == null)
          {
              return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
          }
          Category category = db.Categories.Find(id);
          if (category == null)
          {
              return HttpNotFound();
          }
          return View(category);
      }
  </code></pre>
  
  <p>When I added a line <code>var pro = category.Project</code> just before returning the <code>View(category)</code>  and started debugging, the <code>pro</code> variable was set to <code>null</code>. In <code>Index</code> action the project is explicitly included <code>db.Categories.Include(c =&gt; c.Project).ToList()</code> but not in <code>Details</code>. Do I need to include it explicitly? If yes, how?</p>