Setting up a GraphQL API using HotChocolate
To begin with, you can download the code example named SchoolManagement for this chapter from the chapter12\start folder. This sample project has some basic code for an AppDbContext class and a Teacher class, as well as some seed data. The Teacher class has the following properties:
public class Teacher{
    public Guid Id { get; set; }
    public string FirstName { get; set; } = string.Empty;
    public string LastName { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
    public string? Phone { get; set; }
    public string? Bio { get; set; }
}
You can open the project in VS Code or VS 2022. We will integrate HotChocolate into the project to create a GraphQL API following these steps:
- Add the
HotChocolate.AspNetCoreNuGet package to the project. This package contains the ASP...