title: LINQ filter on navigation property
body: <p>I have the following two entities:</p>
  
  <pre><code>public class Person 
  { 
      public Person() 
      {
          Items = new HashSet&lt;Item&gt;();
      }
  
      public string Id { get; set; }
      public string Name { get; set; }
      public ICollection&lt;Item&gt; Items { get; private set; }
  }
  
  public class Item
  {
      public string Id { get; set; }
      public DateTime Date { get; set; }
      public string Status { get; set; }
      public Person Person { get; set; }
      public string PersonId { get; set; }
  }
  </code></pre>
  
  <p>I would like to select all the persons, and only include their latest Item (ordered by date).</p>
  
  <p>I figured something like this should work:</p>
  
  <pre><code>var persons = _context.Persons
      .Include(e =&gt; e.Items.OrderByDescending(i =&gt; i.Date).Take(1))
      .ToList();
  </code></pre>
  
  <p>But apparently EF Core is unable to do this. The items collection will get very large (> 20000), so loading them all for every person is undesirable. 
  What should I do instead?</p>