liveBook · Manning

Serial attribute

As explained in Building Web APIs with ASP.NET Core

The HotChocolate serial attribute configures GraphQL field execution so selected tasks run sequentially instead of concurrently.

The HotChocolate [Serial] attribute forces selected GraphQL operations to execute one after another instead of concurrently. This protects a shared, scoped ApplicationDbContext from overlapping database operations. section 10.2.3

Query resolver configuration

[Serial] [UsePaging] [UseProjection] [UseFiltering] [UseSorting] public IQueryable<BoardGame> GetBoardGames([Service] ApplicationDbContext context) => context.BoardGames;

Serial execution is a practical workaround for the sample API. A production GraphQL API may instead register an ApplicationDbContext factory, allowing separate context instances. section 10.2.3

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Explains parallel execution, thread-safety failures, attribute placement, and a DbContext factory alternative.
Examples
Demonstrates serial query resolvers and authorized board-game, domain, and mechanic mutations.
What it assumes
Assumes basic GraphQL resolvers and dependency injection while explaining scoped contexts and concurrent query failures.
What you can do after
Configure GraphQL operations to avoid overlapping use of a shared scoped ApplicationDbContext.
How it connects
Connects GraphQL resolvers with Entity Framework Core, IQueryable, DbContext, authorization, and middleware attributes.

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.