title: Check wether a value is present in a different list
body: <p>Relevant (simplified) classes:</p>
  
  <pre><code>    public class Host
      {
          public int HostID { get; set; }
          public String HostName { get; set; }
          public String Description { get; set; }
          public bool Active { get; set; }
      }
  
      public class Service
      {
          public int ServiceID { get; set; }
          public String Description { get; set; }
          public bool Active { get; set; }
  
          public int HostID { get; set; }
          public virtual Host Host { get; set; }
      }
  </code></pre>
  
  <p>I need to populate a list of all services given a list of hosts. So for every host in <code>rsearch.hosts</code>, I need all the services in <code>rsearch.hostservices</code>.</p>
  
  <p>This is what I do now:</p>
  
  <pre><code>rsearch.hostservices = db.Services
  .Where(j =&gt; rsearch.hosts.Select(c =&gt; c.HostID).Contains(j.HostID)).ToList();
  </code></pre>
  
  <p>But I always get the following error</p>
  
  <pre><code> System.NotSupportedException: Unable to create a constant value of type 'xxx.Models.Host'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.
  </code></pre>