Defining GraphQL queries for EF Core models
Now that we have a basic GraphQL service operating successfully, let’s extend it to enable querying the Northwind database.
Adding support for EF Core
We must add another Hot Chocolate package to allow easy dependency service integration of our EF Core database context with GraphQL query classes:
- Add a package reference for Hot Chocolate integration with EF Core and a project reference to the Northwind database context project, as shown highlighted in the following markup:
<ItemGroup> <PackageReference Include="HotChocolate.AspNetCore" Version="13.0.0" /> <PackageReference Include="HotChocolate.Data.EntityFramework" Version="13.0.0" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\Chapter02\Northwind.Common.DataContext .SqlServer\Northwind.Common.DataContext.SqlServer.csproj" /> <...