title: Compare Array of IDs Entity Framework
body: <p>I have a simple scenario for which i want to write LINQ query, But i am unable to get it right. Here is the scenario:</p>
  
  <p>I have 3 Tables: </p>
  
  <pre><code>STUDENT:
      --------------------------
      SID   Name
      ---------------------
      1     Jhon
      2     Mishi
      3     Cook
      4     Steven
  
  COURSE:
      -------------------
      CID     Name
      -------------------
      1       Maths
      2       Physics
      3       Bio
      4       CS
  
  STUDENTCOURSE:
      ---------------------------
      SCID   SID   CID
      -----------------------
      1       1     1
      2       1     2
      3       1     4
      4       2     1
      5       2     2
      6       2     3
      7       3     1
      8       3     4
      10      4     2
  </code></pre>
  
  <p>For this case i want to pass array of course ids to query and return all student those have all the these courses registered against them. What i tried:</p>
  
  <pre><code> int[] cIds = {1,2,4 };
   var result = from s in context.Students
                where s.StudentCourses.Any(sc=&gt; cIds.Contains(sc.CID))
                select s;
  </code></pre>
  
  <p>But this returns students those registered either of the course id 1,2,4.
  Hope you understand my problem. </p>
  
  <p>Thanks for the help.</p>