title: Retrieve all items that are in nested hierarchy
body: <p>My app allows users to assign categories to their items. The classes look like this.</p>
  
  <pre><code>class Item
  {
      public string Id { get; set; }
      /* ... */
      public virtual IEnumerable&lt;Category&gt; Categories { get; set; }
  }
  
  class Category
  {
      public string Id { get; set; }
      public virtual Category Parent { get; set; }
      public virtual IEnumerable&lt;Category&gt; Subcategories { get; set; }
  }
  </code></pre>
  
  <p>As you can see from the above there are are a hierarchy between categories.</p>
  
  <p>If I have the following category tree:</p>
  
  <pre><code>|-- Item 1
  |---- Child 1
  |---- Child 2
  |---- Child 3
  |-- Item 2
  </code></pre>
  
  <p>And the user wants to display Item1, I want to include all the categories for Child 1, 2 and 3 in the result, i.e. four categories should be included (Item 1, Child 1, Child 2, Child 3) in the query.</p>
  
  <p>How can I do this with EntityFrameworkCore. I'm using SQLite as a backend but would prefer to do this without SQL if possible.</p>