title: LINQ - Left Outer Join with multiple parameters in Where clause
body: <p>How can I do this SQL query in LINQ:</p>
  
  <pre><code>select * from chat c
  left outer join lead s on c.key = s.id
  where (typeId = 5 AND c.key = @clientId) OR (c.typeId = 4 AND s.clientId = @clientId)
  </code></pre>
  
  <p>Or this SQL query -- Same, same</p>
  
  <pre><code>select * from chat c
  where (typeId = 5 AND c.key = @clientId) OR (typeId = 4 AND c.key in (select id from lead where clientId = @clientId))
  </code></pre>
  
  <p>What I have:</p>
  
  <pre><code>var chatter = (from chat in linq.Chat
               join lead in linq.Lead
                  on chat.key equals lead.Id.ToString() into clientLeads
                  from cl in clientLeads.Where(l =&gt; l.clientId == clientId).DefaultIfEmpty()
              where (chat.typeId == 5 &amp;&amp; chat.key == clientId.ToString()) ||
                  (chat.typeId == 4 &amp;&amp; chat.key == cl.Id.ToString())
                  select chat).WithPath(prefetchPath).OrderByDescending(c =&gt; c.CreatedDate);
  </code></pre>
  
  <p>The above LINQ query doesn't yeild any results from the latter WHERE clause, what am I missing?</p>