Skip to content

Commit 10b5d68

Browse files
authored
Add Linq2GraphQL C# Client (graphql#1773)
1 parent 723d1bb commit 10b5d68

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Linq2GraphQL
3+
description: A straightforward Linq to GraphQL Client
4+
url: https://linq2graphql.com
5+
github: linq2graphql/linq2graphql.client
6+
---
7+
8+
Linq2GraphQL generates C# classes from the GraphQL schema and and togheter with the nuget package Linq2GraphQL.Client it makes it possible to query the server using Linq expressions.
9+
10+
A simple query that will get the first 10 orders with the primitive properties of orders and the connected customer
11+
```csharp
12+
var orders = await sampleClient
13+
.Query
14+
.Orders(first: 10)
15+
.Include(e => e.Orders.Select(e => e.Customer))
16+
.Select(e => e.Orders)
17+
.ExecuteAsync();
18+
```
19+
20+
An example mutation where we add a new customer and return the Customer Id.
21+
```csharp
22+
var customerId = await sampleClient
23+
.Mutation
24+
.AddCustomer(new CustomerInput
25+
{
26+
CustomerId = Guid.NewGuid(),
27+
CustomerName = "New Customer",
28+
Status = CustomerStatus.Active
29+
})
30+
.Select(e=> e.CustomerId)
31+
.ExecuteAsync();
32+
```

0 commit comments

Comments
 (0)