title: Most efficient method of self referencing tree using Entity Framework
body: <p>So I have a SQL table which is basically </p>
  
  <pre><code>ID, ParentID, MenuName, [Lineage, Depth]
  </code></pre>
  
  <p>The last two columns are auto-computed to help with searching so we can ignore them for now. </p>
  
  <p>I'm creating a drop down menu system with multiple categories. </p>
  
  <p>Unfortunately EF I don't think plays nice with Self referencing tables more than 1 level deep. So I'm left with a few options</p>
  
  <p>1) Create query, order by depth and then create a custom class in C#, populating it one depth at a time. </p>
  
  <p>2) Find some way to eager load the data in EF, I don't think it is possible for an unlimited amount of levels, only a fixed amount. </p>
  
  <p>3) Some other way I'm not even sure about. </p>
  
  <p>Any inputs would be welcomed! </p>