title: How to implement large COALESCE in LINQ-to-SQL query
body: <p>If I have a lot of columns to COALESCE in a TSQL query that needs to be executed as a LINQ-to-SQL query. How can it be converted to an efficient LINQ-to-SQL query? For example:</p>
  
  <pre><code>SELECT COALESCE(t1.Date, t2.DocDate, t3.PostingDate, t4.DocDate, t5.DocDate) DocDate
  FROM t0
  LEFT JOIN t1 ON t0.t1id = t1.id
  LEFT JOIN t2 ON t0.t2id = t2.id
  LEFT JOIN t3 ON t0.t3id = t3.id
  LEFT JOIN t4 ON t0.t4id = t4.id
  LEFT JOIN t5 ON t0.t5id = t5.id
  </code></pre>
  
  <p>Is there any way to write this in a LINQ query better than the following?</p>
  
  <pre><code>Dim result = ( _
     From c in context.t0 _
     Select DocDate=If(t0.t1.Date, If(t0.t2.DocDate, If(t0.t3.PostingDate, _
     If(t0.t4.DocDate, t0.t5.DocDate)))))
  </code></pre>
  
  <p>I actually have a couple dozen columns within the coalesce to "merge", and two different coalesces to return two different coalesced columns, so the result could get pretty messy, and I fear it'd be pretty inefficient if it weren't processed as COALESCE.</p>