3

I want to integrate GraphQL to my existing ASP.NET Framework (with Entity Framework 4) application which has an MSSQL Server as the backend.

While browsing through the GraphQL libraries for .NET I found 2 libraries - graphql-dotnet and graphql-net, being suggested on the GraphQL website (Link: http://graphql.org/code/#c-net)

It seems that (correct me if I'm wrong) :

  1. graphql-dotnet (https://github.com/graphql-dotnet/graphql-dotnet) - This library only supports in-memory data
  2. graphql-net (https://github.com/ckimes89/graphql-net) - This library works well if we want to work with data which has been stored in DB.

Any suggestion or corrections? Is it possible to perform read/write to/from the DB using the former (i.e. graphql-dotnet) library? Or should I use the graphql-net library instead?

Mr.Human
  • 547
  • 2
  • 12
  • 30
  • I have tried graphql-dotnet. That's not just In-memory you can integrate with DB as well. I tried with https://github.com/landmarkhw/Dapper.GraphQL to query from SQL – sandeep Apr 19 '18 at 07:40
  • Here is the sample Application for grapql-dotnet and dapper : https://github.com/sandeepbs404/GraphQlWithDapper.Sample – sandeep May 08 '18 at 07:22

2 Answers2

16

I am one of the contributors to Hot Chocolate.

You can use both frameworks that you have mentioned there.

GraphQL-net is more focused on building a GraphQL schema on IQueryable.

I would say GraphQL-dotnet is the better one of both solution.

There are integrations that support entity framework mapping to GraphQL-dotnet and they are also providing support for DataLoader, which are important to solve N+1 issues when loading data from a backend with GraphQL.

Hot Chocolate is the third framework implementing the GraphQL for .Net Core and .Net Framework (also listed on graphql.org).

It also supports DataLoader and also supports Entity Framework. For people interested we have a nice tutorial with Entity Framework here:

https://github.com/ChilliCream/graphql-workshop

  • 2
    Hey, I currently very new to GraphQL and was wondering if there any downsides using Hot Chocolate over GraphQL-dotnet? The main reason I am considering using Hot Chocolate is the code first approach where all properties of a model are loaded in the graph type and then you can specify further and ignore properties and so on. There are also some other minor things like the ErrorBuilder that look awesome. Did you benchmark both frameworks by any chance? Since both frameworks rely on the asp.net core there shouldn't be that much of a difference if any. I would really appreciate your view. – Artur K. Feb 23 '19 at 21:23
  • @ArturK. There is also schema stitching that we provide with hot chocolate. You can basically use Hot Chocolate to stitch together schemas from various GraphQL servers. https://hotchocolate.io/docs/stitching – Michael Ingmar Staib Mar 14 '19 at 10:14
1

Well, in our project we decided to use graphql-dotnet lib to get data from API services and sharepoint lists - so, it's sort of proxy one WebAPI service. Now we are in production and it works fine with good performance (except getting data from sharepoint list, but it's issue of SharePoint - not graphql-dotnet lib).

btw, lib itself is more stable than graphql-net and has plenty of active contributes.

One more project or, I'd say component, where we decided to use graphql-dotnet lib has released as well. That component allows you to connect to db and configure GraphQL schemes easily (via json file). Already implemented main features like: sort, pagination and complex filter.

Dmitriy
  • 124
  • 2