title: Linq orderby on multiple columns with one potentially null
body: <p>I have a table with 2 fields in it: [Name] and [Order]</p>
  
  <p>[Order] can be null </p>
  
  <p>Using LINQ, I'd like to be able to order by [Order] or if [Order] is null then order by [Name]</p>
  
  <p>here is my non-working code:</p>
  
  <pre><code>from ft in FacetTypes
  orderby ft.Name, ft.Order ascending   
  select ft
  </code></pre>
  
  <p>Is this possible in linq?</p>
  
  <p>EDIT:</p>
  
  <p>[Order] is int?
  [Name] is string</p>
  
  <p>The query is an Entity Framework 4 one. </p>
  
  <p>ANSWER:</p>
  
  <p>This is what I eventually got to work.</p>
  
  <pre><code>ft.Order == null ? ft.Name : SqlFunctions.StringConvert((double)ft.Order)
  </code></pre>