title: Linq how to write a JOIN
body: <p>Linq to EF, I'm using asp.net 4, EF 4 and C#.</p>
  
  <p>Here are two ways I came up with to query my data. Ways A and C are working fine. B however needs to implement and additional WHERE statement (as "where c.ModeContent == "NA").</p>
  
  <p>My question is:</p>
  
  <ul>
  <li>Regarding this kind of join (outer join, I suppose) what is the best approach in term of performance?</li>
  <li>Could you show me some code to implement additional WHERE statement in B?</li>
  <li>Any way to improve this code?</li>
  </ul>
  
  <p>Thanks for your time! :-)</p>
  
  <pre><code>// A               
  var queryContents = from c in context.CmsContents
      where c.ModeContent == "NA" &amp;&amp;
      !(from o in context.CmsContentsAssignedToes select o.ContentId)
      .Contains(c.ContentId)
      select c;
  
  // B - I need to implent where c.ModeContent == "NA"
  var result01 = from c in context.CmsContents
      join d in context.CmsContentsAssignedToes on c.ContentId equals d.ContentId into g
      where !g.Any()
      select c;
  
  // C
  var result02 = context.CmsContents.Where(x =&gt; x.ModeContent == "NA").Where(item1 =&gt; context.CmsContentsAssignedToes.All(item2 =&gt; item1.ContentId != item2.ContentId));
  </code></pre>