title: How to query ICollection<T>?
body: <p>I have two models, where both of them include an <code>ICollection&lt;T&gt;</code> object, something like this:</p>
  <pre><code>public class Business : ApplicationUser
  {
      ...
      public virtual ICollection&lt;Subcategory&gt; Subcategories { get; set; }
      ...
  }
  
  public class Request
  {
      ....
      public virtual ICollection&lt;Subcategory&gt; Subcategories { get; set; }
      ...
  }
  </code></pre>
  <p>I want to query for the businesses and get the businesses whose subcategories match the ones in request (even one match is enough). I have something like this, which I wrote just as a sample, and of course it doesn't work (request is of type Request):</p>
  <pre><code>foreach (var subcategory in request.Subcategories)
  {
      var businesses = db.Users
          .OfType&lt;Business&gt;()
          .Where(b =&gt; b.Subcategories
              .Where(s =&gt; s.SubcategoryName == subcategory.SubcategoryName));
  }
  </code></pre>
  <p>So, for example, let's say we have two businesses, from which the first one has Football and Basketball as subcategories and the second one has Basketball and Tennis. Then, let's say our user selects both Football and Tennis subcategories, so my query should return both businesses, because first one includes Football, and the second one includes Tennis.</p>
  <p>So, not every single subcategory should match, even one match is enough for accepting the business as a result. How can I achieve it? If you can provide the code I would be glad.</p>
  <p>Here is also my subcategory model, in case you need it:</p>
  <pre><code>public class Subcategory
  {
      public int SubcategoryID { get; set; }
  
      public string SubcategoryName { get; set; }
  }
  </code></pre>