title: C# Entity-Framework: How can I combine a .Find and .Include on a Model Object?
body: <p>I'm doing the mvcmusicstore practice tutorial. I noticed something when creating the scaffold for the album manager (add delete edit).</p>
  
  <p>I want to write code elegantly, so i'm looking for the clean way to write this.</p>
  
  <p>FYI i'm making the store more generic:</p>
  
  <p>Albums = Items</p>
  
  <p>Genres = Categories</p>
  
  <p>Artist = Brand</p>
  
  <p>Here is how the index is retrieved (generated by MVC):</p>
  
  <pre><code>var items = db.Items.Include(i =&gt; i.Category).Include(i =&gt; i.Brand);
  </code></pre>
  
  <p>Here is how the item for delete is retrieved:</p>
  
  <pre><code>Item item = db.Items.Find(id);
  </code></pre>
  
  <p>The first one brings back all the items and populates the category and brand models inside the item model. The second one, doesn't populate the category and brand.</p>
  
  <p>How can i write the second one to do the find AND populate whats inside (preferably in 1 line)... theoretically - something like:</p>
  
  <pre><code>Item item = db.Items.Find(id).Include(i =&gt; i.Category).Include(i =&gt; i.Brand);
  </code></pre>