title: Count child matches in linq Entity Framework
body: <p>I try to count the number of child elements for each parent where the parent id is in a list if ints. But the count is not correct. Is it not possible to make a query like this? What is the correct way of doing this?</p>
  
  <pre><code>List&lt;int&gt; ids = [1, 2, 3];
  var counts = (from d in db.Parent where ids.Contains(d.Id) select d.Child.Count()).ToList();
  </code></pre>