title: LINQ many-to-many relationship, how to write a correct WHERE clause?
body: <p>I use many-to-many relationship for my tables.</p>
  
  <p>There is a query:</p>
  
  <pre><code>var query = from post in context.Posts
          from tag in post.Tags where tag.TagId == 10
          select post;
  </code></pre>
  
  <p>Ok, it works fine. I get posts having the tag specified by id.</p>
  
  <p>I have a collection of tag ids. And i want to get posts having every tag in my collection.</p>
  
  <p>I try the following way:</p>
  
  <pre><code>var tagIds = new int[]{1, 3, 7, 23, 56};
  
  var query = from post in context.Posts
          from tag in post.Tags where tagIds.Contains( tag.TagId )
          select post;
  </code></pre>
  
  <p>It doesn't work. The query returns all posts having ANY one of the specified tags.</p>
  
  <p>I want to get a clause like this but dynamicaly for any count of tags in the collection:</p>
  
  <pre><code>post.Tags.Whare(x =&gt; x.TagId = 1 &amp;&amp; x.TagId = 3 &amp;&amp; x.TagId = 7 &amp;&amp; ... )
  </code></pre>