title: Is it possible to query a query in Entity Framework?
body: <p>I come from a ColdFusion background where we made FREQUENT usage of Query of Queries to speed up our page.  I have a query now that brings in a ton of data of all the departments for all of the sites, and on the main page I want to display the information like so:</p>
  
  <pre><code>Site 001
     -  Dept 01
     -  Dept 02
     -  Dept 03
  Site 002
     -  Dept 01
     -  Dept 02
  etc.
  </code></pre>
  
  <p>Normally, I would query all the unique sites in my master query by assigning the master query to a variable, this hits the DB one time.  Then, I'd do a query of queries to query that variable to get the unique sites, then in a foreach loop query that same variable to get the departments for the site.</p>
  
  <p>As far as I can tell in Entity Framework each of my foreach queries is actually going out and querying the DB again from scratch.  Is there no way to reuse data you've already pulled down in EF Core?  I'm working with 100k+ row databases, and while they've got keys and are relatively quick, querying it 900 times on one page load is ridiculous.</p>