🎬 That's a Wrap for GraphQLConf 2024! • Watch the Videos • Check out the recorded talks and workshops

Code Using GraphQL

Sort by:
graphql-dotnet
GraphQL for .NET
Last release 3 days ago6kMIT License
README
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);
  }
}
Strawberry Shake
Strawberry Shake is a open-source reactive GraphQL client for .NET
Last release 1 day ago5kMIT License
README

Strawberry Shake removes the complexity of state management and lets you interact with local and remote data through GraphQL.

You can use Strawberry Shake to:

  • Generate a C# client from your GraphQL queries.
  • Interact with local and remote data through GraphQL.
  • Use reactive APIs to interact with your state.
client.GetHero
    .Watch(ExecutionStrategy.CacheFirst)
    .Subscribe(result =>
    {
        Console.WriteLine(result.Data.Name);
    })
Hot Chocolate
Hot Chocolate is an open-source GraphQL Server for .NET
Last release 1 day ago5kMIT License
README

Hot Chocolate takes the complexity away from building a fully-fledged GraphQL server and lets you focus on delivering the next big thing.

using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
 
WebHost
    .CreateDefaultBuilder(args)
    .ConfigureServices(services =>
        services
            .AddGraphQLServer()
            .AddQueryType<Query>())
    .Configure(builder =>
        builder
            .UseRouting()
            .UseEndpoints(e => e.MapGraphQL()))
    .Build()
    .Run();
 
public class Query
{
    public Hero GetHero() => new Hero();
}
 
public class Hero
{
    public string Name => "Luke Skywalker";
}
graphql-net
Convert GraphQL to IQueryable
1kMIT License
GraphQL.Client
A GraphQL Client for .NET.
Last release 5 months ago1kMIT License
Entity GraphQL
A GraphQL library for .NET Core. Easily expose you data model as a GraphQL API or bring together multiple data sources into a single GraphQL schema.
Last release 1 month ago414MIT License
README
// expose an existing data model with ASP.NET & EF Core
public class Startup {
  public void ConfigureServices(IServiceCollection services)
  {
      services.AddDbContext<DemoContext>();
      // Auto build a schema from DemoContext. Alternatively you can build one from scratch
      services.AddGraphQLSchema<DemoContext>(options =>
      {
          // modify the schema (add/remove fields or types), add other services
      });
  }
 
  public void Configure(IApplicationBuilder app, DemoContext db)
  {
      app.UseRouting();
      app.UseEndpoints(endpoints =>
      {
          // defaults to /graphql endpoint
          endpoints.MapGraphQL<DemoContext>();
      });
  }
}
ZeroQL
ZeroQL is a open-source GraphQL client for C#
Last release 2 months ago278MIT License
README

The ZeroQL is a high-performance C#-friendly GraphQL client. It supports Linq-like syntax, and doesn’t require Reflection.Emit or expressions. As a result, at runtime provides performance very close to a raw HTTP call.

You can use ZeroQL to:

  • Generate a C# client from GraphQL schema.
  • Generate and execute graphql queries from your C# code.
  • Don’t require writing GraphQL manually.
  • Supports .Net Core, .Net Framework, Xamarin, Unity apps.
var userId = 10;
var response = await qlClient.Query(q => q
    .User(userId, o => new
    {
        o.Id,
        o.FirstName,
        o.LastName
    }));
graphql-net-client
Basic example GraphQL client for .NET.
94MIT License
SAHB.GraphQLClient
GraphQL client which supports generating queries from C# classes
Last release 4 years ago44MIT License
NGraphQL
A set of packages for implementing high-performant GraphQL servers in .NET. Faithful implementation of official 2018 Specification. Features batched execution support (aka Data Loader); support for custom scalars; HTTP server based on ASP.NET Core; parsed query cache; modular API construction (equivalent of schema stiching); full introspection support; runtime metrics and quotas.
43MIT License