title: OrderBy in Calculated Columns in LINQ?
body: <p>I have a Database Table for a discussion forum as follows.  ParentID tracks the parent topic if the row represents as reply.</p>
  
  <pre><code>ID  Subject   Body   ParentID
  </code></pre>
  
  <p>In generating a list of topics, I would like to order topics by the number of replies for each topic. Is there a way to dynamically add a calculated column and query the same table for each topic?</p>
  
  <pre><code>List&lt;Topic&gt; topics = (from element in Posts where ParentID is null).OrderBy(m =&gt; m.Replies).ToList();
  </code></pre>
  
  <p>The problem is I don't have a Replies column persisted in the database and want to calculate it at runtime.  Can I use a let keyword or similar?</p>