DEV Community

Discussion on: Learn how you can use GraphQL in .NET Core and C#

 
softchris profile image
Chris Noring

Generally, you use a query that takes a parameter on the GraphQL side

// schema
{
  Query {
    GetCommentById(id: ID): Comment
  } 
}

// asking the query
query <name it something> {
  GetCommentById(id: 1)
}

As for dealing with .NET Core and MongoDB you have a tutorial here docs.microsoft.com/en-us/aspnet/co... . I suppose I could be writing a tutorial on GraphQL, .NET Core and MongoDB if you are interested?

Also have a look here dev.to/dotnet/how-you-can-build-a-... This shows how our request is passed from API to DB layer

Thread Thread
 
jghx profile image
jghx

I tried do to a combination of GraphQL, .NET Core and MongoDB but can seem te get the MongoDb working to you still need to use a DBContext and DBsets or can you just use IMongoCollection's like in the Microsoft tutorial?

Thread Thread
 
noamwe profile image
Noam Wertheim

Hi thank you for the links.
I would be very much interested in reading a tutorial on how to implement a GraphQl server with .NET Core and MongoDb.
So far only managed to implement it when all data sat in memory, which is of course not an acceptable solution.

Thread Thread
 
softchris profile image
Chris Noring

I'm looking into a GraphQL solution currently called Hot Chocolate. It has the concept of loaders. Yes some data need to sit in memory, but not all. Maybe that can offer a path forward? hotchocolate.io/docs/introduction....