title: How to use DataLoader for Connections with Hot Chocolate GraphQL
body: <p>I see that it's possible to use Data Loaders for root queries, but is it also possible to use Data Loaders for nested connections?  In the example below, I want use a Data Loader for the <code>rooms</code> property.  In the example request at the bottom, there will be three database queries made.  One by the data loader to fetch both buildings, one to fetch the rooms for building 1, and another to fetch the rooms for building 2.  Instead, I'm trying to use a data loader for the rooms, so only two database queries are made.</p>
  <pre><code>// Building DB table
  ID | Name
  1  | Main Campus
  2  | Satellite Campus
  </code></pre>
  <pre><code>// Rooms DB table
  ID | BuildingId | Name
  1  | 1          | Lab
  2  | 1          | Dorm
  3  | 2          | Theatre
  4  | 2          | Gym
  </code></pre>
  <pre><code>// Schema
  type Building {
    id: Int!
    name: String!
    rooms(after: String before: String first: PaginationAmount last: PaginationAmount): RoomsConnection
  }
  
  type Room {
    id: Int!
    name: String!
    building: Building!
  }
  </code></pre>
  <pre><code>// Hot Chocolate
  public class BuildingType: ObjectType&lt;Building&gt; {
    protected override void Configure(IObjectTypeDescriptor&lt;Building&gt; descriptor)
    {
      // ... omitted other fields for brevity
  
      // Instead of using a resolver, can a data loader be used instead?
      descriptor.Field(b =&gt; b.rooms).UsePaging&lt;RoomType&gt;().Resolver(ctx =&gt; {
        var building = ctx.Parent&lt;Building&gt;();
        var roomsRepository = ctx.Service&lt;IRoomsRepository&gt;();
        return roomsRepository.GetRoomsByBuildingId(building.Id);
      });
    }
  }
  </code></pre>
  <pre><code>// Example request
  query {
    a: building(id: 1){
      id,
      name,
      rooms {
        nodes {
          id,
          name
        }
      }
    },
    b: building(id: 2){
      id,
      name,
      rooms {
        nodes {
          id,
          name
        }
      }
    }
  }
  </code></pre>