Overview

Every field in a GraphQL schema is backed by a resolver function that produces the field's value. Understanding how resolvers compose into a tree is the key mental model for building efficient GraphQL APIs with Hot Chocolate.

The Resolver Tree

When Hot Chocolate receives a query, it builds a resolver tree that mirrors the shape of the request. Consider this query:

GraphQL
query {
me {
name
company {
id
name
}
}
}

This produces the following resolver tree:

graph LR
  A(query: QueryType) --> B(me: UserType)
  B --> C(name: StringType)
  B --> D(company: CompanyType)
  D --> E(id: IdType)
  D --> F(name: StringType)

The execution engine traverses this tree starting from root resolvers. A child resolver can only execute after its parent has produced a value. Sibling resolvers at the same level run in parallel. Because of this parallel execution, resolvers (except top-level mutation fields) must be free of side effects.

Execution completes when every resolver in the tree has produced a result.

Resolvers

Resolvers are the building blocks of data fetching. A resolver can call a database, a REST API, a gRPC service, or any other data source. In Hot Chocolate v16, the source generator is the primary way to define resolvers. You write plain C# methods and the generator wires them into the schema.

Learn more about resolvers

DataLoader

DataLoaders deduplicate and batch requests to data sources. When multiple resolvers request the same entity in a single request, a DataLoader ensures only one call goes to the backing store. DataLoaders can significantly reduce the load on your databases and services.

Learn more about DataLoaders

Pagination

Hot Chocolate provides cursor-based connection pagination out of the box. Connections follow the Relay Cursor Connections Specification, giving clients a standardized way to page through large datasets. When backed by IQueryable, pagination translates directly to native database queries.

Learn more about pagination

Filtering

When you return a list of entities, clients often need to filter them by operations like equals, contains, or startsWith. Hot Chocolate generates the necessary filter input types from your .NET models and translates applied filters into native database queries.

Learn more about filtering

Sorting

Hot Chocolate generates sort input types from your .NET models, allowing clients to specify which fields to sort by and in which direction. Like filtering, sort operations translate to native database queries when backed by IQueryable.

Learn more about sorting

Projections

Projections optimize database queries by selecting only the columns that match the fields requested in the GraphQL query. If a client requests name and id, Hot Chocolate queries only those columns from the database.

Learn more about projections

Data Sources

Hot Chocolate is not bound to a specific database or architecture. You can fetch data from any source in your resolvers. We provide specific guidance for the most common patterns:

Next Steps

Last updated on April 13, 2026 by Michael Staib