GraphQL with ASP.NET Core (Part- VII : Mutation)

We've been dealing with data fetching so far. But how do you cause side effects on the server-side data? Side effects can be anything ranging from a data insertion, patching, deletion or update. GraphQL mutation is just the thing you are looking for here.

Before we move forward, I would like to do a bit of housekeeping on the project. So, I've changed the name of the HelloWordQuery object graph type to InventoryQuery. Also, the HelloWordSchema is now replaced with InventorySchema. And I've removed the hello and howdy fields out of the root query object.

A mutation type also extends from ObjectGraphType. Following createItem field creates an item on the server side and returns it.

Notice, we have a new ItemInputType as query argument. Previously, in Part-V, we had an example where we worked with a scaler type argument. But for passing a complex type as arguments, we have to work differently. Hence, come a new type i.e InputObjectType. I've created a new ItemInputType and extend it from InputObjectGraphType,