Skip to content

Commit 31249a8

Browse files
committed
Update README and add to solution
The README.md file has been updated to improve code snippet readability and include new badges. Additionally, the README file has been added to the Linq2GraphQL solution for easier access.
1 parent 744411a commit 31249a8

2 files changed

Lines changed: 31 additions & 22 deletions

File tree

Linq2GraphQL.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".items", ".items", "{7A8567
1111
Directory.Build.props = Directory.Build.props
1212
nuget.config = nuget.config
1313
version.json = version.json
14+
README.md = README.md
1415
EndProjectSection
1516
EndProject
1617
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Linq2GraphQL.TestServer", "test\Linq2GraphQL.TestServer\Linq2GraphQL.TestServer.csproj", "{AD8291B6-5979-4C43-B785-EAD4FF93C564}"

README.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,37 @@
77
<p>A straightforward Linq to GraphQL Client</p>
88

99
<h4> <a href="https://linq2graphql.com"> Documentation </a> <span> · </span> <a href="https://github.com/Linq2GraphQL/Linq2GraphQL.Client/issues"> Report Bug </a> <span> · </span> <a href="https://github.com/Linq2GraphQL/Linq2GraphQL.Client/issues"> Request Feature </a> </h4>
10+
11+
[![Build](https://github.com/Linq2GraphQL/Linq2GraphQL.Client/actions/workflows/ci.yml/badge.svg)](hhttps://github.com/Linq2GraphQL/Linq2GraphQL.Client/actions/workflows/ci.yml?branch=master)
12+
1013
</div>
1114

1215
# Introduction
1316
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.
1417

1518
A simple query that will get the first 10 orders with the primitive properties of orders and the connected customer.
16-
17-
var orders = await sampleClient
18-
.Query
19+
```cs
20+
var orders = await sampleClient
21+
.Query
1922
.Orders(first: 10)
2023
.Include(e => e.Orders.Select(e => e.Customer))
2124
.Select(e => e.Orders)
2225
.ExecuteAsync();
26+
```
2327

2428
A example mutation where we add a new customer and return the Customer Id.
25-
26-
var customerId = await sampleClient
27-
.Mutation
28-
.AddCustomer(new CustomerInput
29-
{
30-
CustomerId = Guid.NewGuid(),
31-
CustomerName = "New Customer",
32-
Status = CustomerStatus.Active
33-
})
34-
.Select(e=> e.CustomerId)
35-
.ExecuteAsync();
36-
29+
```cs
30+
var customerId = await sampleClient
31+
.Mutation
32+
.AddCustomer(new CustomerInput
33+
{
34+
CustomerId = Guid.NewGuid(),
35+
CustomerName = "New Customer",
36+
Status = CustomerStatus.Active
37+
})
38+
.Select(e=> e.CustomerId)
39+
.ExecuteAsync();
40+
```
3741

3842
# Getting Started
3943
## Generate Client code
@@ -65,23 +69,27 @@ As an example:
6569
Would generate a client from url *https://spacex-production.up.railway.app/* with the name *SpaceXClient* in the namespace *SpaceX* to folder *Generated*
6670

6771
## Add Nuget
68-
Add the Nuget Package [Linq2GraphQL.Client](https://www.nuget.org/packages/Linq2GraphQL.Client)
72+
Add the Nuget Package [![Nuget](https://img.shields.io/nuget/v/Linq2GraphQL.Client.svg)](https://www.nuget.org/packages/Linq2GraphQL.Client)
6973

7074
dotnet add package Linq2GraphQL.Client --prerelease
7175

7276
## Dependency Injection
7377
The client adds a set of extensions to make it easier to add the client to dependency injection.
7478
As an example this would add SpaceXClient to the container:
75-
76-
services.SpaceXClient(x =>
79+
```cs
80+
services
81+
.SpaceXClient(x =>
7782
{
7883
x.UseSafeMode = false;
7984
})
80-
.WithHttpClient(
81-
httpClient => { httpClient.BaseAddress = new Uri("https://spacex-production.up.railway.app/"); });
82-
85+
.WithHttpClient(
86+
httpClient =>
87+
{
88+
httpClient.BaseAddress = new Uri("https://spacex-production.up.railway.app/");
89+
});
90+
```
8391
## Safe Mode
84-
Turning on *SafeMode* will make the client before the first request to do an introspection query to the endpoint. The schema will be used to make sure that any auto included properties are available. This is an advanced feature that require the endpoint to support introspection. By default safe mode is turned of.
92+
Turning on *SafeMode* will make the client before the first request to do an introspection query to the endpoint. The schema will be used to make sure that any auto included properties are available. This is an advanced feature that require the endpoint to support introspection. By default safe mode is turned of.
8593

8694
# Acknowledgments
8795
Linq2GraphQL is inspired by [GraphQLinq](https://github.com/Giorgi/GraphQLinq) , thank you [Giorgi](https://github.com/Giorgi)

0 commit comments

Comments
 (0)