title: Filter list of entity objects by string child object property using Linq Lambda
body: <p>I am trying to return an IQueryable lands filtered by a child object property Owner.Name. Is working well with the query style solution, but I want to use a lambda one.</p>
  
  <p>On short these are my classes mapped by EntityFramework:</p>
  
  <pre><code>public class Land
  {
       public int Id { get; set; }
  
       public virtual ICollection&lt;Owner&gt; Owners { get; set; }
  }
  
  public class Owner
  {
          public int Id { get; set; }
          public string Name { get; set; }
          public int LandId { get; set; }
  
          public virtual Land Lands { get; set; }
  }
  </code></pre>
  
  <p>The query which is working fine:</p>
  
  <pre><code> var list = from land in db.Lands
                     join owner in db.Owners on land.Id equals Owner.LandId
                     where owner.Name.Contains("Smit")
                     select land;
  </code></pre>
  
  <p>I was trying using this:</p>
  
  <pre><code>var list = db.Lands.Where(lnd =&gt; lnd.Owners.Count() &gt; 0 &amp;&amp;
               lnd.Owners.Where(own =&gt; own.Name.Contains("Smit")).Count() &gt; 0);
  </code></pre>
  
  <p>It works only for small lists, but for some with thousands of records it gives timeout.</p>