Query GraphQL with LINQ
See original GitHub issueI’m not sure whether this feature belongs to this project or not but I wanted to share my suggestion and a prototype I built.
Problem:
Querying a GraphQL endpoint requires writing a string query that is neither strongly typed, nor checked by the compiler. As LINQ solved the same problem it would be cool to do use LINQ for GraphQL queries too.
Solution
I have built a prototype called GraphQLinq that generates strongly typed client from GraphQL API and allows writing graphQL queries like this:
var spaceXContext = new QueryContext();
var companySummary = spaceXContext.Company().Select(c => new CompanySummary
{
Ceo = c.Ceo,
Name = c.Name,
Headquarters = c.Headquarters
}).ToItem();
This will generate a GraphQL query, run it and deserialize response in the corresponding class.
It supports quering nested properties and you can find more examples in the Readme of the project.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Introducing GraphQLinq - Strongly Typed GraphQL ...
Running GraphQL Queries with LINQ ... The scaffolding tool generates QueryContext class that serves as an entry point for writing and running LINQ...
Read more >LINQ to GraphQL Data
LINQ provides general-purpose query facilities in .NET Framework 3.0 and above and provides one easy way to programmatically access data through from CData ......
Read more >Strongly-Typed GraphQL Queries with LINQ to ...
I want to introduce my project - GraphQLinq that allows you to write graphQL queries with LINQ. It also includes a .
Read more >Mapping GraphQL query to Select() linq to sql
I am building an Web API with .NET core using GraphQL and DocumentDb . In theory, GraphQL is optimized the data is shipped...
Read more >LINQ support
GraphQL server offers an ability to apply that information in form of LINQ expression on top of an existing IQueryable<> collection. Such application...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’re definitely interesting in anything GraphQL and .NET, thanks for opening this and for the discussion. Please don’t hesitate to ping me or the rest of the team for anything.
We can move to the project repo for more details. I opened it here because EF Core 6 plans mentioned GraphQL and wanted to bring the project to the ef team’s attention.