liveBook · Manning

Mutation root type

As explained in Building Web APIs with ASP.NET Core

A mutation root type is the GraphQL operation type that exposes operations that modify application data.

A mutation root type is the GraphQL operation type that exposes write operations against application data, such as inserts, updates, and deletes. Unlike the required Query root type, Mutation is optional and remains stateless. section 10.2.3

In the board-game API, a public Mutation class becomes the write boundary for board games, domains, and mechanics. Its methods receive the EF Core context and a DTO, modify a matching entity, save changes asynchronously, and return the updated entity when available. section 10.2.3

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Defines root-type responsibilities and demonstrates methods, persistence, serialization, authorization, and registration without detailing GraphQL request syntax.
Examples
Demonstrates board-game, domain, and mechanic update and delete methods registered through Program.cs.
What it assumes
Assumes C# classes, EF Core contexts, DTOs, and role authorization while establishing GraphQL root types from schema setup.
What you can do after
Build it with HotChocolate by defining mutation methods, enforcing roles, saving changes, and registering the mutation root.
How it connects
Connects GraphQL schema, Query root type, Subscription root type, EF Core, DTOs, and authorization.

Related concepts

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.