Skip to content
GraphQL Conventions Library for .NET
Branch: master
Clone or download
tlil Bump to version 2.0.4
 * Fix test namespace
 * Add WithQueryExtensions to GraphQLEngine (#141)
 * Bump version number
Latest commit 742b2a9 Mar 12, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
samples Support for c# extensions (#136) Mar 3, 2019
src/GraphQL.Conventions Bump to version 2.0.4 Mar 12, 2019
test/Tests Bump to version 2.0.4 Mar 12, 2019
Conventions.sln Project structure Feb 21, 2017 Add missing license header Oct 6, 2018 Update Feb 21, 2017

GraphQL Conventions Library for .NET


GraphQL .NET has been around for a while. This library is a complementary layer on top that allows you to automatically wrap your .NET classes into GraphQL schema definitions using existing property getters and methods as field resolvers.

In short, this project builds on top of the following components:


Download and install the package from NuGet:

PS> Install-Package GraphQL.Conventions

The following targets are available:

  • .NET Framework 4.5
  • .NET Platform Standard 1.5

Getting Started

Implement your query type:

public class Query
    [Description("Retrieve book by its globally unique ID.")]
    public Task<Book> Book(UserContext context, Id id) =>

    [Description("Retrieve author by his/her globally unique ID.")]
    public Task<Author> Author(UserContext context, Id id) =>

    [Description("Search for books and authors.")]
    public Connection<SearchResult> Search(
        UserContext context,
        [Description("Title or last name.")] NonNull<string> forString,
        [Description("Only return search results after given cursor.")] Cursor? after,
        [Description("Return the first N results.")] int? first)
        return context
            .Select(node => new SearchResult { Instance = node })
            .ToConnection(first ?? 5, after);

Construct your schema and run your query:

using GraphQL.Conventions;

var engine = GraphQLEngine.New<Query>();
var result = await engine


More detailed examples can be found in the unit tests.

You can’t perform that action at this time.