DEV Community

Chris Noring for Microsoft Azure

Posted on

Free workshop on .NET Core + GraphQL + Serverless

Follow me on Twitter, happy to take your suggestions on topics or improvements /Chris

TLDR; This is a free workshop for learning GraphQL, Serverless and Micro services in .NET Core and C#. It is free and is under MIT license, please use to learn or teach others.

This workshop can be found at

https://aka.ms/graphql-workshop-dotnet

References

Sign up for a free Azure account
To create Serverless Azure Functions you will need a free Azure account

Starter guide .NET Core
Completely new to .NET Core? Then start here. It will tell you all about how to use the CLI to scaffold projects, run and build them.

Serverless + GraphQL
This shows how you can build a GraphQL API in Net, we also show mutations. The article then proceeds to host the GraphQL API in a Serverless app.

Serverless app in .Net
Building a Serverless REST API is quite easy using Azure Functions and some great plugins in VS Code. This is the 10-20 min of coding, depending on your caffeine level ;) Getting to use .NET and C# while building is even greater

Serverless App using CosmosDB and database bindings
Bindings are a great feature in Serverless that takes care of connecting to your data source. Writing a CRUD API is super simple thanks to it.

 Workshop content

this workshop covers the following areas

 -1- GraphQL API

This first part covers GraphQL. You will be taught to define a schema in gql and learn concepts such query, mutation, resolvers. We will learn both how to read and write data and how to resolve nested queries

 -2- Microservices

In this part, we will learn how to build a Microservice in .NET Core and C#. We will also learn how to containerize our services and how to get them up and running with Docker and docker-compose.

-3- Serverless

In this part, we will learn how to serve our GraphQL API from within a Serverless function.

 -4- Deployment

Here we will learn to lift everything to the Cloud. We will push our microservices to a so-called Azure Container Registry, a private container repo in the Cloud and from there create endpoints in the Cloud.

We will also learn how to deploy the Serverless function to the Cloud

If you see any areas for improvement please raise issues and PRs here

https://github.com/softchris/graphql-workshop-dotnet/tree/master/

Top comments (6)

Collapse
 
shaijut profile image
Shaiju T

Thanks for the efforts 😄, Is GraphSQL is similar to OData ? Does it generates SQL statements on the fly. Will GraphSQL replace Odata ?

Collapse
 
softchris profile image
Chris Noring

no, it doesn't become SQL, it's its own thing entirely.. In a sense, it's like SQL but on API level instead of close the database. Graphql will be more widely used I think.

Collapse
 
pascalsenn profile image
PascalSenn

Hi Shaijut & Chris
So GraphQL is not directly converted to SQL. But we do have a couple feature in hotchocolate.io that enable you to do so

Given this Query type we generate all the nested types you need. By annotating with attributes you can add additional behaviour on top of it.

public class Query {
     [UsePaging]
     [UseSelection]
     [UseSorting]
     [UseFiltering]
     public IQueryable<Jedi> GetJedis([Service]DBContext ctx) 
       => ctx.Jedis.AsQueryable()

}

When you now execute this query

{
  jedis(where: {name: "Han"}, order_by:{side:DESC}) { name side }
}

This SQL statement is executed:

SELECT [p].[Name],[p].[Side]
FROM [Jedis] AS [p]
WHERE [p].[Name] ="Han"
ORDER BY [p].[Side] DESC
Thread Thread
 
shaijut profile image
Shaiju T

Hi 😄 , What is difference b/w GraphQL for .NET and hotchocolate.io ? Why I should I use hotchocolate.io ? Anything special ?

Thread Thread
 
pascalsenn profile image
PascalSenn

Very good question :)
I think HotChocolate provides you with more features and more innovation. Code looks cleaner and it is overall much more fun to work with.
This question as asked in a issue once. You can read more about it here:
github.com/ChilliCream/hotchocolat...

This is a really good blog post about HotChocolate.
It only shows a fraction of it tough :D
dev.to/michaelstaib/get-started-wi...

Check out this example project If you want to get a feeling for it

Also, just join the community and try it out :)
You can find us on if you have any question along the way SLACK

Collapse
 
stephanvs profile image
Stephan van Stekelenburg

Hi, thanks for writing this all up, that's rather helpful. I've created a PR on your GitHub since I noticed a small issue :-)