Skip to content

Commit ab34ce1

Browse files
authored
Merge pull request graphql#555 from joemcbride/patch-1
GraphQL .NET sample code
2 parents 0d27ef1 + 32a1397 commit ab34ce1

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

site/code/index.html.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,34 @@ In addition to the GraphQL [reference implementations in JavaScript](#javascript
4242
4343
### C# / .NET
4444
45-
- [graphql-dotnet](https://github.com/graphql-dotnet/graphql-dotnet): GraphQL for .NET
45+
#### [graphql-dotnet](https://github.com/graphql-dotnet/graphql-dotnet): GraphQL for .NET
46+
47+
\`\`\`csharp
48+
using System;
49+
using GraphQL;
50+
using GraphQL.Types;
51+
52+
public class Program
53+
{
54+
public static void Main(string[] args)
55+
{
56+
var schema = Schema.For(@"
57+
type Query {
58+
hello: String
59+
}
60+
");
61+
62+
var json = schema.Execute(_ =>
63+
{
64+
_.Query = "{ hello }";
65+
_.Root = new { Hello = "Hello World!" };
66+
});
67+
68+
Console.WriteLine(json);
69+
}
70+
}
71+
\`\`\`
72+
4673
- [graphql-net](https://github.com/ckimes89/graphql-net): Convert GraphQL to IQueryable
4774
- [Hot Chocolate](https://github.com/ChilliCream/hotchocolate): GraphQL Server for .NET core and .NET classic
4875

0 commit comments

Comments
 (0)