title: Using an list in a query in entity framework
body: <p>I am trying to find a way to pass in an optional string list to a query. What I am trying to do is filter a list of tags by the relationship between them. For example if c# was selected my program would suggest only tags that appear in documents with a c# tag and then on the selection of the next, say SQL, the tags that are linked to docs for those two tags together would be shown, whittling it down so that the user can get closer and closer to his goal.</p>
  
  <p>At the moment all I have is:</p>
  
  <pre><code>List&lt;Tag&gt; _tags =  (from t in Tags
                     where t.allocateTagDoc.Count &gt; 0
                     select t).ToList();
  </code></pre>
  
  <p>This is in a method that would be called repeatedly with the optional args as tags were selected.</p>
  
  <hr>
  
  <p>I think I have been coming at it arse-backwards. If I make two(or more) queries one for each supplied tag, find the docs where they all appear together and then bring out all the tags that go with them... Or would that be too many hits on the db? Can I do it entirely through an entity context variable and just query the model?</p>
  
  <p>Thanks again for any help!</p>