MMitrevskiGet in touch
Back to writing

Article · Toni

Introducing GraphQL in .Net Core 3.1 with Hot chocolate and DynamoDb

Like enthusiastic in the programing , I always want challenges and from the start of this year GraphQL gave me really good impression how it's working

From the Mitrevski archive·Toni

Like enthusiastic in the programing , I always want challenges and from the start of this year GraphQL gave me really good impression how it's working

I opened https://graphql.org/code/, and like developer with PHP/JS background experience, I was in doubt on which new language to try so I would have benefit on both side (new programing language and new technology GraphQL)

And I chose the first on the list :)

So funny I will learn new language

Next thing after clicking on C#, I got this page

Now another headache, which library to chose????????

To be honest after a week investigating and trying all libraries I finally found the winner and that was

Hot Chocolate

Why Hotchocolate, because I found the documentation very useful, easy to implement and the community is growing too rapidly

So now I will introduce how I used Hotchocolate library to communicate with DynamoDB

I won't show how Hotchocolate installation process is, you can visit Hot Chocolate. The documentation is very nice, current version si 10, but they will release version 11 and it will have breaking changes, and the guys from Hotchocolate have Slack channel, so if you need some help please join Join Hotchocolate community slack channel

So let's start

First you need to install nudged packages fro DynamoDB

<PackageReference Include="AWSSDK.Core" Version="3.3.106.21" <PackageReference Include="AWSSDK.DynamoDBv2" Version="3.3.106.1"

Next is to create one Interface so after that to be registered in the IOC




Next is register the config in IOC



Now Lets let's create a repository and service




Last thing is the service to be injected in Hotchocolate Query class

If you need some help and got stuck on installation or something else feel free to contact me. I will be more than glad to help.

Cheers

Toni

Written by

Toni Mitrevski

Technical product owner and solution architect, connecting product strategy, scalable systems, and engineering delivery.