Skip to content

Latest commit

 

History

History
33 lines (29 loc) · 614 Bytes

graphql-dotnet.md

File metadata and controls

33 lines (29 loc) · 614 Bytes
name description github
graphql-dotnet
GraphQL for .NET
graphql-dotnet/graphql-dotnet
using System;
using System.Threading.Tasks;
using GraphQL;
using GraphQL.Types;
using GraphQL.SystemTextJson; // First add PackageReference to GraphQL.SystemTextJson

public class Program
{
  public static async Task Main(string[] args)
  {
    var schema = Schema.For(@"
      type Query {
        hello: String
      }
    ");

    var json = await schema.ExecuteAsync(_ =>
    {
      _.Query = "{ hello }";
      _.Root = new { Hello = "Hello World!" };
    });

    Console.WriteLine(json);
  }
}