Skip to content

orders conversion

Herb Stahl edited this page May 29, 2019 · 3 revisions

Original

graphql-dotnet/example-orders
baseline

Final Conversion

conversion result

The original contains a schema which will be removed because P7Core.GraphQLCore owns the master schema. Mutation, Query and Subscriptions now have to be registered with the DI using the following interfaces;
IMutationFieldRegistration
IQueryFieldRegistration
ISubscriptionFieldRegistration

Mutation Conversion

original
You will notice that the original registers all the fields in the constructor.
We will inherit this class from IMutationFieldRegistration and move those registrations into the required method. In the constructor, we do our normal storing away of injected services.

converted

Query Conversion

original
You will notice that the original registers all the fields in the constructor.
We will inherit this class from IQueryFieldRegistration and move those registrations into the required method. In the constructor, we do our normal storing away of injected services.

converted

Registering Your New API

Registering occurs in our host apps StartUp.cs using the following registration extension

services.AddGraphQLOrders();