Suche senden
Hochladen
GraphQL with .NET Core
•
1 gefällt mir
•
979 views
M
Mark Lechtermann
Folgen
GraphQL with .NET Core
Weniger lesen
Mehr lesen
Internet
Melden
Teilen
Melden
Teilen
1 von 97
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
The Site is the API
The Site is the API
Nathan Yergler
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
Gianluca Carucci
Working Software 2019 - TypeScript come (forse) non lo hai mai visto
Working Software 2019 - TypeScript come (forse) non lo hai mai visto
Gianluca Carucci
Building GraphQL API in C#.pptx
Building GraphQL API in C#.pptx
Brandon Minnick, MBA
Introduction to GraphQL
Introduction to GraphQL
Brandon Minnick, MBA
Xamarin + GraphQL
Xamarin + GraphQL
Brandon Minnick, MBA
Building GraphQL APIs in C#
Building GraphQL APIs in C#
Kim Minnick, PHR
Instagram filters (10-5)
Instagram filters (10-5)
Ivy Rueb
Empfohlen
The Site is the API
The Site is the API
Nathan Yergler
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
Gianluca Carucci
Working Software 2019 - TypeScript come (forse) non lo hai mai visto
Working Software 2019 - TypeScript come (forse) non lo hai mai visto
Gianluca Carucci
Building GraphQL API in C#.pptx
Building GraphQL API in C#.pptx
Brandon Minnick, MBA
Introduction to GraphQL
Introduction to GraphQL
Brandon Minnick, MBA
Xamarin + GraphQL
Xamarin + GraphQL
Brandon Minnick, MBA
Building GraphQL APIs in C#
Building GraphQL APIs in C#
Kim Minnick, PHR
Instagram filters (10-5)
Instagram filters (10-5)
Ivy Rueb
Buildingplatforms
Buildingplatforms
codebits
API Technical Writing
API Technical Writing
Sarah Maddox
LarKC Tutorial at ISWC 2009 - Second Hands-on Scenario
LarKC Tutorial at ISWC 2009 - Second Hands-on Scenario
LarKC
Building GraphQL API in C#.pptx
Building GraphQL API in C#.pptx
Brandon Minnick, MBA
Ontotext's GraphDB Connectors
Ontotext's GraphDB Connectors
logomachy
Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0
Estelle Weyl
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
marpierc
Let's talk about GraphQL
Let's talk about GraphQL
Commit Software Sh.p.k.
Taming WebSocket with Scarlet
Taming WebSocket with Scarlet
Zhixuan Lai
Open Social Summit Korea Overview
Open Social Summit Korea Overview
Chris Schalk
Lecture 9 Professional Practices
Lecture 9 Professional Practices
Sur College of Applied Sciences
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case Study
Mark Meeker
BNC Tech Forum 09: Lexcycle Stanza demo
BNC Tech Forum 09: Lexcycle Stanza demo
BookNet Canada
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
Association Paris-Web
Baremetal deployment
Baremetal deployment
baremetal
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
DevOps_Fest
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
Guillaume Laforge
Apache Flink Adoption @ Shopify
Apache Flink Adoption @ Shopify
KevinLam737856
Apache Flink Adoption at Shopify With Kevin Lam | Current 2022
Apache Flink Adoption at Shopify With Kevin Lam | Current 2022
HostedbyConfluent
Knative with .NET Core and Quarkus with GraalVM
Knative with .NET Core and Quarkus with GraalVM
Mark Lechtermann
Microsoft Connect 2018 .NET User Group Paderborn
Microsoft Connect 2018 .NET User Group Paderborn
Mark Lechtermann
Weitere ähnliche Inhalte
Ähnlich wie GraphQL with .NET Core
Buildingplatforms
Buildingplatforms
codebits
API Technical Writing
API Technical Writing
Sarah Maddox
LarKC Tutorial at ISWC 2009 - Second Hands-on Scenario
LarKC Tutorial at ISWC 2009 - Second Hands-on Scenario
LarKC
Building GraphQL API in C#.pptx
Building GraphQL API in C#.pptx
Brandon Minnick, MBA
Ontotext's GraphDB Connectors
Ontotext's GraphDB Connectors
logomachy
Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0
Estelle Weyl
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
marpierc
Let's talk about GraphQL
Let's talk about GraphQL
Commit Software Sh.p.k.
Taming WebSocket with Scarlet
Taming WebSocket with Scarlet
Zhixuan Lai
Open Social Summit Korea Overview
Open Social Summit Korea Overview
Chris Schalk
Lecture 9 Professional Practices
Lecture 9 Professional Practices
Sur College of Applied Sciences
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case Study
Mark Meeker
BNC Tech Forum 09: Lexcycle Stanza demo
BNC Tech Forum 09: Lexcycle Stanza demo
BookNet Canada
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
Association Paris-Web
Baremetal deployment
Baremetal deployment
baremetal
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
DevOps_Fest
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
Guillaume Laforge
Apache Flink Adoption @ Shopify
Apache Flink Adoption @ Shopify
KevinLam737856
Apache Flink Adoption at Shopify With Kevin Lam | Current 2022
Apache Flink Adoption at Shopify With Kevin Lam | Current 2022
HostedbyConfluent
Ähnlich wie GraphQL with .NET Core
(20)
Buildingplatforms
Buildingplatforms
API Technical Writing
API Technical Writing
LarKC Tutorial at ISWC 2009 - Second Hands-on Scenario
LarKC Tutorial at ISWC 2009 - Second Hands-on Scenario
Building GraphQL API in C#.pptx
Building GraphQL API in C#.pptx
Ontotext's GraphDB Connectors
Ontotext's GraphDB Connectors
Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
Let's talk about GraphQL
Let's talk about GraphQL
Taming WebSocket with Scarlet
Taming WebSocket with Scarlet
Open Social Summit Korea Overview
Open Social Summit Korea Overview
Lecture 9 Professional Practices
Lecture 9 Professional Practices
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case Study
BNC Tech Forum 09: Lexcycle Stanza demo
BNC Tech Forum 09: Lexcycle Stanza demo
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
Baremetal deployment
Baremetal deployment
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
Apache Flink Adoption @ Shopify
Apache Flink Adoption @ Shopify
Apache Flink Adoption at Shopify With Kevin Lam | Current 2022
Apache Flink Adoption at Shopify With Kevin Lam | Current 2022
Mehr von Mark Lechtermann
Knative with .NET Core and Quarkus with GraalVM
Knative with .NET Core and Quarkus with GraalVM
Mark Lechtermann
Microsoft Connect 2018 .NET User Group Paderborn
Microsoft Connect 2018 .NET User Group Paderborn
Mark Lechtermann
MQTT with .NET Core
MQTT with .NET Core
Mark Lechtermann
DevOps - Experimentieren aber wie? - Björn Senft
DevOps - Experimentieren aber wie? - Björn Senft
Mark Lechtermann
Electron
Electron
Mark Lechtermann
Short introduction - .net core and .net standard 2.0
Short introduction - .net core and .net standard 2.0
Mark Lechtermann
DevOps: Automatisierte Deployments mit TFS & Octopus Deploy
DevOps: Automatisierte Deployments mit TFS & Octopus Deploy
Mark Lechtermann
6. Treffen der .NET User Group Paderborn
6. Treffen der .NET User Group Paderborn
Mark Lechtermann
5. Treffen der .NET User Group Paderborn
5. Treffen der .NET User Group Paderborn
Mark Lechtermann
Mehr von Mark Lechtermann
(9)
Knative with .NET Core and Quarkus with GraalVM
Knative with .NET Core and Quarkus with GraalVM
Microsoft Connect 2018 .NET User Group Paderborn
Microsoft Connect 2018 .NET User Group Paderborn
MQTT with .NET Core
MQTT with .NET Core
DevOps - Experimentieren aber wie? - Björn Senft
DevOps - Experimentieren aber wie? - Björn Senft
Electron
Electron
Short introduction - .net core and .net standard 2.0
Short introduction - .net core and .net standard 2.0
DevOps: Automatisierte Deployments mit TFS & Octopus Deploy
DevOps: Automatisierte Deployments mit TFS & Octopus Deploy
6. Treffen der .NET User Group Paderborn
6. Treffen der .NET User Group Paderborn
5. Treffen der .NET User Group Paderborn
5. Treffen der .NET User Group Paderborn
Kürzlich hochgeladen
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
girls4nights
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
soniya singh
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
Thierry TROUIN ☁
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
anamikaraghav4
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Sheetaleventcompany
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
soniya singh
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Damian Radcliffe
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
Diya Sharma
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
soniya singh
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
ellan12
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
kojalkojal131
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
sexy call girls service in goa
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
vipmodelshub1
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Delhi Call girls
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
divyansh0kumar0
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
dollysharma2066
Kürzlich hochgeladen
(20)
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
GraphQL with .NET Core
1.
@MarkLechtermann Mark Lechtermann @MarkLechtermann GraphQL with
.NET CORE
2.
@MarkLechtermann What‘s wrong with
REST?
3.
@MarkLechtermann Architectural Styles and
the Design of Network-based Software Architectures DISSERTATION DOCTOR OF PHILOSOPHY Roy Thomas Fielding 2000
4.
@MarkLechtermann
5.
@MarkLechtermann 2000
6.
@MarkLechtermann
7.
8.
@MarkLechtermann The internet in
the year 2000
9.
@MarkLechtermann not before 2002
10.
@MarkLechtermann not before 2004
11.
@MarkLechtermann 2019
12.
@MarkLechtermann 2000 vs 2019
13.
@MarkLechtermann Web 2000 GET http://example.com static
HTML
14.
@MarkLechtermann Web 2000 GET http://example.com static
HTML
15.
@MarkLechtermann Web 2019 I want
JSON! I want HTML! I want JS! I want IOT data! I want a stream!
16.
@MarkLechtermann Web 2019 I want
JSON! I want HTML! I want JS! I want IOT data! I want a stream!
17.
@MarkLechtermann Again: What‘s wrong
with REST?
18.
@MarkLechtermann Over-fetching GET http://example.com/api/v1/whiskys/1 { "name":"ArdbegTEN", "strength":46, "distillery":"Ardbeg", "size":"700 ml", "prize":45.00, … }
19.
@MarkLechtermann Over-fetching GET http://example.com/api/v1/whiskys/1 { "name":"ArdbegTEN", "strength":46, "distillery":"Ardbeg", "size":"700 ml", "prize":45.00, … } But
all I wanted was the prize!
20.
@MarkLechtermann Under-fetching GET http://example.com/api/v1/whiskys "items":[ "http://example.com/api/v1/whiskys/1" "http://example.com/api/v1/whiskys/2" … ] GET http://example.com/api/v1/whiskys/1 GET
http://example.com/api/v1/whiskys/2 ...
21.
@MarkLechtermann Under-fetching GET http://example.com/api/v1/whiskys "items":[ "http://example.com/api/v1/whiskys/1" "http://example.com/api/v1/whiskys/2" … ] GET http://example.com/api/v1/whiskys/1 GET
http://example.com/api/v1/whiskys/2 ... But all I wanted was a list of names!
22.
@MarkLechtermann REST Properties ● Performance ●
Reliability ● Simplicity ● Scalability ● Modifiability ● Portability
23.
@MarkLechtermann REST Benefits ● Performance
(with HTTP2) ● Well-established ● Media types ● Decoupling server and client
24.
@MarkLechtermann The problem with
REST ● Difficult to implement correctly ● Tooling for clients ● API description format – Swagger, RAML, API Blueprint, Odata...? ● It's not a Standard
25.
@MarkLechtermann We call it
a "REST"-API
26.
@MarkLechtermann Richardson Maturity Model HATEOAS HTTP
Verbs Resources Swamp of POX
27.
@MarkLechtermann Let's be honest! HATEOAS?
28.
@MarkLechtermann But what about
OpenAPI/Swagger?
29.
@MarkLechtermann OpenAPI/Swagger kills Hypermedia!
30.
@MarkLechtermann Nobody stops us
from using the endpoint directly!
31.
@MarkLechtermann REST without Hypermedia is
CRUD over HTTP!
32.
@MarkLechtermann
33.
@MarkLechtermann
34.
@MarkLechtermann react.js conf 2015 not
only for React!
35.
@MarkLechtermann Knots and Edges not Resources
36.
@MarkLechtermann Spec ● https://graphql.github.io/graphql-spec/ ● Latest
stable version – June 2018
37.
@MarkLechtermann Let's build an
App
38.
@MarkLechtermann Whisky Distillery 0..1 * WhiskyApp
39.
@MarkLechtermann Whisky Distillery 0..1 * WhiskyApp Iknow! Independentbottler,blends,… butKISS!
40.
@MarkLechtermann Whisky +Name : string +Age
: uint +Strength: float + Size: uint Distillery +Name : string +Owner : string +SpiritStills : uint +WashStills : uint +Capacity : uint64 +Region : string 0..1 * WhiskyApp
41.
@MarkLechtermann
42.
@MarkLechtermann
43.
@MarkLechtermann We need Components!
44.
@MarkLechtermann whiskys
45.
@MarkLechtermann whiskys name age
46.
@MarkLechtermann whiskys name age distillery
47.
@MarkLechtermann whiskys name age distillery name owner
48.
@MarkLechtermann { whiskys { name age distillery { name owner } } }
49.
@MarkLechtermann { whiskys { name age distillery { name owner } } } GraphQL Query APPROVED
50.
@MarkLechtermann
51.
@MarkLechtermann A query language
for your API
52.
@MarkLechtermann GraphQL Feature ● Query ●
Mutation ● Subscription
53.
@MarkLechtermann Schema
54.
@MarkLechtermann Schema schema { query: WhiskyRootQuery mutation:
WhiskyRootMutation }
55.
@MarkLechtermann Scalar Types type Whisky
{ MyField1 : ID // unique identifier String MyField2 : Int MyField3 : Float // signed double-precision MyField4 : String // UTF-8 MyField5 : Boolean }
56.
@MarkLechtermann Type type WhiskyRootQuery { whiskys:
[Whisky] whisky(id: ID): Whisky }
57.
@MarkLechtermann Lists and Non-Null type
WhiskyRootQuery { whiskys: [whisky!]! whisky(id: ID!): whisky }
58.
@MarkLechtermann Interfaces interface Drink { id:
ID! name: String! }
59.
@MarkLechtermann Implements Interface type Whisky
implements Drink { region: WhiskyRegion }
60.
@MarkLechtermann Enumerations enum WhiskyRegion { LOWLANDS HIGHLANDS SPEYSIDE CAMPELTOWN ISLAY THE
ISLANDS }
61.
@MarkLechtermann Query
62.
@MarkLechtermann Query query { whiskys { id name } } "data"
{ "whiskys" : [ { "id" : "1", "name": "Ardbeg Ten" } ] }
63.
@MarkLechtermann Query { whiskys { id name } } "data" { "whiskys"
: [ { "id" : "1", "name": "Ardbeg Ten" } ] }
64.
@MarkLechtermann Query with Arguments { whisky(id:
"1") { id name } } "data" { "whisky" : { "id" : "1", "name": "Ardbeg Ten" } }
65.
@MarkLechtermann Alias { first : whisky(id:"1")
{ name } second : whisky(id:"2") { name } } { "data": { "first": { "name": "Ardbeg TEN" }, "second": { "name": "Ardbeg Uigeadail" } } }
66.
@MarkLechtermann Fragments { first : whisky(id:"1")
{ ...myFields } second : whisky(id:"2") { ...myFields } } fragment myFields on WhiskyType{ name id strength } { "data": { "first": { "name": "Ardbeg TEN", "id": "1", "strength": 46 }, … } }
67.
@MarkLechtermann Variables query Compare($a: ID!,
$b: ID!){ first : whisky(id:$a) { ...myFields } second : whisky(id:$b) { ...myFields } } fragment myFields on WhiskyType { name id strength } { "data": { "first": { "name": "Ardbeg TEN", "id": "1", "strength": 46 }, … } }
68.
@MarkLechtermann Directives - include query
GetWhisky($id: ID!, $dInfo: Boolean = false) { whisky(id:$id) { id name destillery @include(if: $dInfo) { name } } } {"id": "1", "dInfo": true} { "data": { "whisky" : { "id" : "12, "name" : "Ardbeg TEN" "destillery" : { "name" : "Ardbeg" } } } }
69.
@MarkLechtermann Directives - skip query
GetWhisky($id: ID!, $dInfo: Boolean = false) { whisky(id:$id) { id name destillery @skip(if: $dInfo) { name } } } {"id": "1", "dInfo": true} { "data": { "whisky": { "id": 1, "name": "Ardbeg TEN", } } }
70.
@MarkLechtermann Mutation
71.
@MarkLechtermann mutation mutation { deleteWhisky(id: "1") } { "data"
: { "deleteWhisky" : true } }
72.
@MarkLechtermann mutation mutation { addWhisky( destilleryId :
"1" whisky : { name : "MyWhisky" age : 0 size : 70 strength : 40 } ) { id name } } { "data" : { "addWhisky" : { "id" : "123", "name" : "MyWhisky", } } }
73.
@MarkLechtermann Let‘s start with
.NET Core
74.
@MarkLechtermann .NET Libraries ● graphql-dotnet/graphql-dotnet
(~3000) ● ckimes89/graphql-net ( ~700) ● ChilliCream/hotchocolate ( ~300)
75.
@MarkLechtermann We use graphql-dotnet/graphql-dotnet in this
example
76.
@MarkLechtermann Code First or Schema First
77.
@MarkLechtermann $ dotnet new
webapi $ dotnet add package GraphQL $ dotnet add package GraphQL.Server.Transports.AspNetCore # Optional: $ dotnet add package GraphQL.Server.Ui.GraphiQL $ dotnet add package GraphQL.Server.Ui.Playground $ dotnet add package GraphQL.Server.Ui.Voyager Create a new project
78.
@MarkLechtermann public class WhiskyType
: ObjectGraphType<WhiskyEntity> { public WhiskyType() { Field<NonNullGraphType<IdGraphType>>().Name("id"); Field(entity => entity.Name).Description(""); } } Add Types
79.
@MarkLechtermann public class WhiskyQuery
: ObjectGraphType { public WhiskyQuery() { this.Field<WhiskyType>( name: "whisky", resolve: context => new WhiskyType()); } Add Query
80.
@MarkLechtermann public class WhiskyAppSchema
: Schema { public WhiskyAppSchema(IDependencyResolver resolver) : base(resolver) { Query = resolver.Resolve<WhiskyQuery>(); Mutation = ... } } Add a Schema
81.
@MarkLechtermann public void ConfigureServices(IServiceCollection
services) { services.AddScoped<WhiskyType>(); services.AddScoped<WhiskyQuery>(); services.AddScoped<ISchema, WhiskyAppSchema>(); services.AddScoped<IDependencyResolver>( s => new FuncDependencyResolver(s.GetRequiredService)); services.AddSingleton<IDocumentExecuter, DocumentExecuter>(); services.AddSingleton<IDocumentWriter, DocumentWriter>(); services.AddGraphQL(); } Add Services
82.
@MarkLechtermann app.UseGraphQL<ISchema>("/graphql"); // Optional: app.UseGraphiQLServer(new GraphiQLOptions()); app.UseGraphQLPlayground(new
GraphQLPlaygroundOptions()); app.UseGraphQLVoyager(new GraphQLVoyagerOptions()); Add Middleware
83.
@MarkLechtermann N + 1
Problem and Batching!
84.
@MarkLechtermann Use a Dataloader
85.
@MarkLechtermann services.AddSingleton<IDataLoaderContextAccessor, DataLoaderContextAccessor>(); services.AddSingleton<DataLoaderDocumentListener>(); DataLoader - Services
86.
@MarkLechtermann public WhiskyType( IDataLoaderContextAccessor
accessor) { … Field<DestilleryType, DestilleryEntity>() .Name("destillery") .ResolveAsync(context => { var loader = accessor.Context.GetOrAddBatchLoader<string, DestilleryEntity>("whisky_destillery", ... ); return loader.LoadAsync(context.Source.Id); }); } DataLoader
87.
@MarkLechtermann Pro GraphQL ● Easy
to learn ● Vendor agnostic ● Pragmatic ● Contract ● Introspection
88.
@MarkLechtermann Contra GraphQL ● Content
negotiation ● Media type support ● Caching ● "Only" POST – What about GET, DELETE, PUT?
89.
@MarkLechtermann API Gateway REST JSON over
HTTP OData gRPC
90.
@MarkLechtermann What are the
alternatives?
91.
@MarkLechtermann REST! ;-) ...
92.
@MarkLechtermann … with OData
93.
@MarkLechtermann OData @ Build
2019 ● Microsoft PowerApps – https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/overview ● Build2019: Microsoft Graph powers the Microsoft 365 platform – https://developer.microsoft.com/en-us/office/blogs/build-2019-microsoft-graph-powers-the-microsoft-365-platform/ ● Graph Explorer – https://developer.microsoft.com/en-us/graph/graph-explorer ● Expamples: – https://graph.microsoft.com/v1.0/me/?$select=givenName – https://graph.microsoft.com/v1.0/me?$select= displayName, skills
94.
@MarkLechtermann Contra OData ● Strong
coupling with the database ● Query only with GET – Long and complex URL
95.
@MarkLechtermann docker run -p
5000:5000 marklechtermann/whiskygraphqlapp Docker Image
96.
@MarkLechtermann https://github.com/marklechtermann/ whiskygraphqlapp Source Code
97.
@MarkLechtermann Thanks! Any Questions?
Jetzt herunterladen