NGql.Core 1.2.0

dotnet add package NGql.Core --version 1.2.0
NuGet\Install-Package NGql.Core -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NGql.Core" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NGql.Core --version 1.2.0
#r "nuget: NGql.Core, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NGql.Core as a Cake Addin
#addin nuget:?package=NGql.Core&version=1.2.0

// Install NGql.Core as a Cake Tool
#tool nuget:?package=NGql.Core&version=1.2.0

Project Logo

NGql

Schemaless GraphQL query builder for .NET Core with fluent syntax. Zero dependencies.

GitHub license

Quick Start

dotnet add package NGql.Core

Usage

Library allows creation of Query and Mutation's. Both have an implicit conversion to string.

Query

var query = new Query("PersonAndFilms")
    .Select(new Query("person")
        .Where("id", "cGVvcGxlOjE=")
        .Select("name")
        .Select(new Query("filmConnection")
            .Select(new Query("films")
                .Select("title")))
    );

the output will be the following

query PersonAndFilms{
    person(id:"cGVvcGxlOjE="){
        name
        filmConnection{
            films{
                title
            }
        }
    }
}

Mutation

var mutation = new Mutation("CreateUser")
                .Select(new Query("createUser")
                    .Where("name", "Name")
                    .Where("password", "Password")
                    .Select("id", "name"))
                .ToString();

the output will be the following

mutation CreateUser{
    createUser(name:"Name", password:"Password"){
        id
        name
    }
}

Variables

Variables allows to reuse existing queries and mutations instead of building them from start every time.

Passing variables

// define a variable
var variable = new Variable("$name", "String");

// pass as constructor parameter
var ctor = new Query("name", variables: variable);

// or as method variable
var fluent = new Query("name", variables: variable).Variable(variable););

the output will be the following

query name($name:String){
    id
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 141 3/24/2024
1.1.1 962 10/16/2023
1.1.1-alpha.0.1 57 10/5/2023
1.1.0 2,520 10/3/2023
1.0.0 12,002 11/28/2021
0.1.6 1,256 11/19/2021
0.1.5 1,486 10/22/2021
0.1.3 1,353 10/11/2021
0.1.2 889 9/15/2021
0.1.1 754 9/9/2021
0.1.0 738 9/9/2021
0.0.0-alpha.0.24 54 10/3/2023