https://github.com/dibble-james/linql
LINQ like access to a GraphQL Server
https://github.com/dibble-james/linql
csharp csharp-sourcegenerator dotnet graphql graphql-client graphql-dotnet
Last synced: 8 months ago
JSON representation
LINQ like access to a GraphQL Server
- Host: GitHub
- URL: https://github.com/dibble-james/linql
- Owner: dibble-james
- License: mit
- Created: 2022-06-18T19:09:00.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-09-06T10:01:36.000Z (10 months ago)
- Last Synced: 2025-09-06T11:39:00.415Z (10 months ago)
- Topics: csharp, csharp-sourcegenerator, dotnet, graphql, graphql-client, graphql-dotnet
- Language: C#
- Homepage:
- Size: 120 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# LinQL
## LINQ-like access to GraphQL endpoints in .Net
[](https://github.com/dibble-james/LinQL/actions/workflows/nuget.yml)
[](https://www.nuget.org/packages/LinQL/)
### Supported Operations
- [x] Queries
- [x] Mutations
- [x] Input Types
- [x] Arguments
- [x] Interfaces/Unions
- [x] Auto-generating types via introspection
- [x] Subscriptions
- [x] Custom Scalars
#### Coming soon
- [ ] Strawberry Shake support
### Getting Started using `GraphQL.Client`
1. Install the Nuget package
```bash
dotnet add package LinQL
dotnet add package LinQL.GraphQL.Client
```
2. Reference a `.graphql` SDL in your csproj
```xml
```
3. Create a client:
```csharp
using StarWars.Types;
var client = new GraphQLHttpClient(
"https://swapi-graphql.netlify.app/.netlify/functions/index",
new SystemTextJsonSerializer(new JsonSerializerOptions().WithKnownInterfaces()))
.WithLinQL(new LinQLOptions().WithKnownScalars());
```
4. Write queries!
```csharp
using GraphQL.Client.Abstractions;
using StarWars.Types; // As defined by LinQLClientNamespace
public class StarWarsClient
{
private readonly IGraphQLClient graph;
public StarWarsClient(IGraphQLClient graph) => this.graph = graph;
public async Task GetFilmById(string id, CancellationToken cancellationToken)
=> await this.graph.SendAsync((Root x) => x.GetFilm(id), cancellationToken);
}
```
### Getting Started using `StrawberryShake`
Coming soon...
### What can I do with it?
A range of expressions can be converted as demonstrated by [the `TranslationProviderTests`](https://github.com/dibble-james/LinQL/blob/interface-support/LinQL.Tests/Translation/TranslationProviderTests.cs).
If you come accross something that doesn't work, please raise an issue or a pull request with a supporting test.
For more help check out the [docs](https://github.com/dibble-james/LinQL/wiki)
### Troubleshooting
There are a couple gotchas with the source generator that can be solved using the guides [here](https://github.com/dibble-james/LinQL/wiki/troubleshooting/)