Web Development · WDC-100

GraphQL API with ASP.NET Core and Hot Chocolate

GraphQL API with ASP.NET Core and Hot Chocolate is a course in building GraphQL APIs with C# on .NET 10 and Hot Chocolate, from schema design and SQL Server access with EF Core and DataLoader to mutations, subscriptions and API protection. It suits C# and ASP.NET Core developers who build APIs for websites and mobile apps.

Updated
From 11,610 THB / person 12,900 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration18 hours · 3 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

GraphQL lets client applications ask for exactly the data they need in a single call, through one endpoint backed by a strongly typed schema, which makes it a good fit for systems where websites, mobile apps and several services share the same data. On .NET the most widely used tool is Hot Chocolate, which turns C# classes and methods into a GraphQL schema automatically and ships with Nitro, a built-in IDE for testing queries.

This course teaches how to build GraphQL APIs with ASP.NET Core on .NET 10 and Hot Chocolate 16. Learners start with the query language and schema design, connect to SQL Server with EF Core 10, solve the N+1 problem with DataLoader, add paging, filtering and sorting, write mutations and subscriptions, add authentication and authorisation, protect the API from overly expensive queries, call it from a client with Strawberry Shake, and finish by testing and deploying with Docker. (3 days, 6 hours per day, 18 hours in total, Intermediate level.)

What you’ll gain

  • Understand how GraphQL works and when to use it instead of, or alongside, REST
  • Write queries with arguments, aliases, fragments, variables and directives
  • Design schemas and types with Hot Chocolate 16 on ASP.NET Core 10
  • Read data from SQL Server with EF Core 10 and solve the N+1 problem with DataLoader
  • Implement paging, filtering, sorting, mutations and subscriptions
  • Protect the API with authorisation, cost analysis and trusted documents
  • Call a GraphQL API from a .NET client with Strawberry Shake
  • Test, monitor and deploy a GraphQL server with Docker

Who this course is for

  • C# and ASP.NET Core developers who want to build APIs with GraphQL
  • Backend developers who run REST APIs and need to serve many kinds of client
  • Teams still on GraphQL with .NET 6 or an older Hot Chocolate who want to update
  • Frontend and mobile developers who want to understand GraphQL design on the server

Prerequisites

  • C# programming, including classes, methods, async/await and basic LINQ
  • Some experience building websites or web APIs with ASP.NET Core
  • Familiarity with databases and basic SQL
  • A laptop that can run the .NET 10 SDK and Docker Desktop, with rights to install software

Curriculum

Course Details

This course is the 2026 edition of GraphQL API with ASP.Net 6, rewritten for .NET 10 (LTS), ASP.NET Core 10, EF Core 10 and Hot Chocolate 16. It runs for 3 days, 6 hours per day (18 hours in total, 09:00-16:00), as lectures with labs built around a sample shop system that grows throughout the course. Intermediate level. Day one covers the query language and schema design, day two connects to SQL Server with EF Core 10 and adds DataLoader, paging, filtering and mutations, and day three covers subscriptions, authorisation, protection against expensive queries, a Strawberry Shake client, and testing and deployment with Docker. All classroom tools are free, and learners take home the source code for every lab.

Day 1 GraphQL Fundamentals and Schema Design

Section 1: What GraphQL Is and Where It Fits

  • The over-fetching and under-fetching problems of REST APIs
  • GraphQL compared with REST and gRPC: strengths and limits
  • The core building blocks: schema, query, mutation and subscription
  • GraphQL tooling on .NET and an overview of Hot Chocolate
  • When to run GraphQL alongside REST in an organisation

Section 2: Lab: Setting Up .NET 10 and a Hot Chocolate Project

  • Install the .NET 10 SDK, the Hot Chocolate templates and the extensions you need
  • Create a project with dotnet new graphql and explore its structure
  • Register AddGraphQLServer and MapGraphQL in Program.cs
  • Test a first query in Nitro at the /graphql endpoint
  • Lab: put the project under Git from day one

Section 3: Lab: The GraphQL Query Language

  • Basic queries and selecting nested fields
  • Arguments, and aliases for calling the same field more than once
  • Fragments and inline fragments for reusing parts of a query
  • Variables, and directives such as @include and @skip
  • Lab: query products and categories in a single request

Section 4: Schemas and the Type System

  • Scalar and object types, including the extra scalars Hot Chocolate provides
  • Interface and union types
  • Enum and input object types
  • Lists and non-null, and how they map to C# nullable reference types
  • Read and design schemas in SDL

Section 5: Lab: Implementation-First Schemas

  • Build a query type with attributes such as [QueryType] and the source generator
  • Type extensions for splitting resolvers by domain
  • Use XML documentation comments as schema descriptions
  • Introspection, __typename and exporting the schema to a file
  • Lab: a shop schema with products, categories and orders
Day 2 Data, Performance and Mutations

Section 6: Lab: Connecting to SQL Server with EF Core 10

  • Create models, a DbContext and migrations on SQL Server 2025
  • Register a DbContext factory for use with Hot Chocolate
  • Resolvers that read data through the DbContext and injected services
  • Nested fields for related data
  • Lab: query products with their categories from a real database

Section 7: Lab: DataLoader and the N+1 Problem

  • How the N+1 query problem arises in GraphQL
  • Batch and group DataLoaders
  • Create DataLoaders with the source generator
  • Inspect the SQL actually sent with EF Core logging
  • Lab: cut hundreds of database calls down to a handful

Section 8: Lab: Paging, Filtering, Sorting and Projection

  • Cursor-based paging with connections, and offset paging
  • Filtering and sorting translated into EF Core queries
  • Projection so only the columns the client asks for are read
  • Performance pitfalls and limiting page size
  • Lab: a product search that filters, sorts and pages

Section 9: Lab: Mutations and Input Types

  • Design mutations the recommended way, with inputs and payloads
  • Hot Chocolate mutation conventions
  • Create, update and delete data within a transaction
  • Validate input before saving to the database
  • Lab: a mutation that places an order and adjusts stock

Section 10: Error Handling and Validation

  • How errors appear in a GraphQL response
  • Errors modelled in the schema compared with system errors
  • Error filters that keep internal details away from clients
  • Query validation under the GraphQL specification
  • Lab: return an error the client can display when stock runs out
Day 3 Real-Time, Security, Clients and Deployment

Section 11: Lab: Real-Time Subscriptions

  • How subscriptions work and the WebSocket transport
  • In-memory subscriptions for a single server
  • Redis subscriptions when running several instances
  • Publish events from mutations when data is created or changed
  • Lab: real-time notification of new orders

Section 12: Lab: Authentication and Authorisation

  • JWT bearer authentication on ASP.NET Core 10
  • Register AddAuthorization on both ASP.NET Core and the GraphQL server
  • [Authorize] on types and fields, with roles and policies
  • Read the current user in resolvers to filter data by permission
  • Lab: customers see only their own orders

Section 13: Protecting the API from Expensive Queries

  • Cost analysis and setting cost limits for queries
  • Limit query depth and execution time
  • Turn off introspection in production
  • Persisted operations and trusted documents
  • Lab: send a deeply nested query and see how the server rejects it

Section 14: Lab: Calling the API from a Client

  • Generate a typed client with Strawberry Shake from .graphql files
  • Run queries and mutations from a .NET application
  • Receive subscriptions over WebSocket on the client
  • An overview of calling GraphQL from JavaScript with fetch
  • Lab: a console app that lists products and places orders through the API

Section 15: Workshop: Testing, Monitoring and Deployment

  • Integration tests for the schema and resolvers with xUnit
  • Logging and OpenTelemetry for tracing query execution
  • Workshop: deploy the GraphQL server with SQL Server and Redis using Docker
  • Present the result and a pre-production checklist

Schedule & training options

For individuals — public rounds

No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770

For organisations — in-house / private

  • Tailor the content to your team’s tools and projects
  • Your dates, at your office or live online
  • Quotation with tax ID for procurement
Corporate training quote

Instructors

Frequently asked questions

How does GraphQL differ from a REST API?

REST exposes a separate endpoint for each resource, and each returns a fixed shape of data, so clients often get too much or too little and need several calls. GraphQL uses a single endpoint where the client writes a query naming exactly the fields it needs, including nested data, and gets it in one request. A strongly typed schema acts as the contract between client and server. In practice many organisations run both side by side.

What is the difference between queries, mutations and subscriptions in GraphQL?

A query only reads data, much like GET in REST. A mutation creates, updates or deletes data and can return the changed result in the same call. A subscription lets the client receive data in real time when something happens on the server, such as a new order, usually over a WebSocket connection. When Hot Chocolate runs on several instances, Redis is commonly used to carry the events between them.

What are the steps to build a GraphQL API on .NET 10 with Hot Chocolate and EF Core?

Install the Hot Chocolate templates and create a project with dotnet new graphql on .NET 10. Set up EF Core 10 with models, a DbContext and migrations, then register a DbContext factory alongside AddGraphQLServer in Program.cs. Write a query class using attributes such as [QueryType] so the source generator builds the schema, map the /graphql endpoint with MapGraphQL and test it in Nitro before adding DataLoader, paging, mutations and subscriptions.

Who is the GraphQL API with ASP.NET Core and Hot Chocolate course for, and what should I know beforehand?

It suits C# and ASP.NET Core developers who want to build APIs with GraphQL, backend developers who need to serve many kinds of client, and teams on older GraphQL setups for .NET who want to update. You should be able to write C#, understand classes, async/await and basic LINQ, have built a website or web API with ASP.NET Core, and know basic SQL.

What will I be able to do after the GraphQL API with ASP.NET Core and Hot Chocolate course?

You will be able to write queries with arguments, aliases, fragments, variables and directives, design schemas with Hot Chocolate 16 on .NET 10, read SQL Server data with EF Core 10 and DataLoader, implement paging, filtering, mutations and subscriptions, protect the API with authorisation and cost analysis, call it with Strawberry Shake and deploy it with Docker. Participants who complete the training receive a Certificate of Completion with its own number, which can be verified online.

Can the GraphQL API with ASP.NET Core and Hot Chocolate course be run in-house for our team?

Yes. It can be run in-house for your team, with examples adapted to your own work, such as designing the schema around the databases or systems your team already maintains, or planning the move of an existing GraphQL server to .NET 10. You can request a quotation from this page, or contact us on LINE @itgenius or by phone on 02-570-8449.

Related articles

Articles are published in Thai.