DEV Community

Discussion on: How YOU can build a Web API using GraphQL .Net Core and Entity Framework

Collapse
 
nk54 profile image
NK54

Hello, nice article / tutorial ! I've discovered few things here.
I still face a problem : I don't have any documentation : it says "no schema available" any idea ? Maybe you can give a link to a repo where I can try your code to see if I made a typo somewhere.
You wrote "public string Id { get; set; }" in the Book class. But inserting new item throw an error because EntityFrameworkCore doesn't seem to handle string Id. I fixed that by switching to int. You may also want to add a note to seed the database in the main method before the call to CreateHostBuilder(args).Build().Run(); otherwise the in memory db will be empty.

It feels like GraphQL is awesome to build a product until all UI are done and at some point, maybe switching to pure EF queries (to avoid N+1) might be a better option if performance matters.

Have a good day and thanks again !

Collapse
 
softchris profile image
Chris Noring

hi there. Here's a repo github.com/softchris/graphql-ef-demo Let me know if that solves things for you /Chris

Collapse
 
nk54 profile image
NK54

Hey ! Thanks :)
It doesn't compile with .NET Core 3 / 3.1
Book id of type string throw an error.
The repo doesn't have right dependencies set : entityframeworkcore and entityframeworkcore.inmemory.

I've fixed those issues and I still don't see any documentation : no schema available. At least, I didn't make a typo and I can move on without getting a headache trying to find what's wrong :D

Have a good day !

Thread Thread
 
softchris profile image
Chris Noring

let me look at that and get back to you. Thanks for pointing out the above :)