How to implement Generic Queries by combining EntityFramework Core and GraphQL.NET?

Currently, I have struggled with the problems that I have to implement many times the query for any entity in my data model. I thought if we can expose all entities to the APIs (or maybe have a way to limited some of the sensitive entities) would be great, and then others simply to query it (like a generic query to avoid boilerplate code when we implemented over and over the query function for all entities in the system).

I spend a long time to have a look at OData project (parser part actually), but couldn’t end up with the satisfaction. Maybe because it is too complex and a lot of schemas need to define in the up-front. And moreover, it is only used by .NET ecosystem (Microsoft Dynamic CRM, Microsoft Sharepoint… used that).

I want a solution that can work and adapt well to other ecosystems like front-end, mobile or maybe IoT devices can consume the data output easily. That is a reason I choose GraphQL by Facebook. About this one, I think I don’t need to explain much about why it is so cool at these times. For more information about it, I highly recommend you to read this article 2017: The year in GraphQL.

In this article, I will show you about my POC project that tries to combine Entity Framework Core and GraphQL.NET. We can query from the front-end using gql DSL language and query every entity in your database.

The full article can be found at https://hackernoon.com/how-to-implement-generic-queries-by-combining-entityframework-core-and-graphql-net-77ac8faf4a22

Thank you for your reading. Don't forget to like and share it so that the community can see it.

loading...

No Comments