Entry point
Where a query starts — and where variables are referenced.
GraphQL
Static entry points for the fluent GraphQL API. A string that is not a Var is always treated as a literal, escaped value.
static GraphQLVariable Var(string name)
method
References a variable previously declared with AddVariable. Rendered as $name.
$) to reference.Builder
Assembles the document and its variables.
GraphQLQueryBuilder
Builds a GraphQL query or mutation and its variables from a fluent, strongly-typed description. Configure it on one thread; once configured, Query and Variables may be read concurrently — they allocate their own output and never mutate shared state. Do not add queries or variables while another thread is reading.
GraphQLQueryBuilder(bool mutation = false)constructorCreates a builder for a query, or for a mutation when mutation is true.
mutation rather than a query.string Query { get; }propertyThe generated GraphQL document. Built on each access.
JsonObject Variables { get; }propertyThe declared variables and their values, camelCased, ready to send alongside Query.
GraphQLRequest Request { get; }propertyThe Query and Variables bundled as a request payload.
int QueriesCount { get; }propertyThe number of root queries (or mutations) currently added.
GraphQLQueryBuilder AddQuery<T>(GraphQLQueryObject<T> queryObject)methodAdds a root query (or mutation) object.
GraphQLQueryBuilder AddVariable(string name, object value)methodDeclares a variable, inferring its GraphQL type from the value's CLR type.
$).GraphQLQueryBuilder AddVariable(string name, GraphQLParameterType type, object value)methodDeclares a variable with an explicit GraphQL type, rather than inferring it from the value.
$).GraphQLQueryBuilder AddVariable(GraphQLParameter parameter)methodDeclares a variable from a pre-built parameter.
GraphQLQueryBuilder AddVariables(params GraphQLParameter[] parameters)methodDeclares several variables in one call.
Selection · root
Selects fields on a root query object.
GraphQLQueryObject<T>
A root query (or mutation) object selecting fields of T. T is the type whose fields are selected.
GraphQLQueryObject<T>(string name)constructorCreates a query object for the given GraphQL field name.
…<T> AddField<TProperty>(Func<T, TProperty> selector, string aliasName = null)methodSelects a scalar field, e.g. AddField(x => x.Id).
x => x.Id.alias: field.selector; leave unset.…<T> AddField<TProperty>(Func<T, TProperty> selector, Func<…> complexPropertySelector, string aliasName = null)methodSelects a nested object field and its sub-selection, e.g. AddField(x => x.Adresse, a => a.AddField(v => v.City)).
x => x.Adresse.alias: field.selector; leave unset.…<T> AddCollectionField<TProperty>(Func<T, IEnumerable<TProperty>> selector, Func<…> complexPropertySelector, string aliasName = null)methodSelects a collection field and its sub-selection, e.g. AddCollectionField(x => x.Contacts, c => c.AddEveryFields()).
x => x.Contacts.alias: field.selector; leave unset.…<T> WithArguments<TArguments>(TArguments arguments)methodSets the query arguments from an anonymous object. Use Var for variable references.
new { where = new { id = new { eq = 1 } } }.…<T> As(string aliasName)methodGives this query an alias (rendered as alias: name).
…<T> AddEveryFields()methodSelects every scalar and enum property of T.
…<T> Except<TProperty>(Func<T, TProperty> selector)methodRemoves a previously selected field (e.g. after AddEveryFields).
x => x.Name.selector; leave unset.Selection · nested
Selects sub-fields inside a nested object or collection.
GraphQLQueryObjectField<T>
Builds the sub-selection of a nested object or collection field of element type T. The non-generic GraphQLQueryObjectField is a selected field that may itself carry a nested selection.
…<T> AddField<TProperty>(Func<T, TProperty> selector, string aliasName = null)methodSelects a scalar sub-field.
x => x.Id.alias: field.selector; leave unset.…<T> AddField<TProperty>(Func<T, TProperty> selector, Func<…> complexPropertySelector, string aliasName = null)methodSelects a nested object sub-field and its sub-selection.
x => x.Adresse.alias: field.selector; leave unset.…<T> AddCollectionField<TProperty>(Func<T, IEnumerable<TProperty>> selector, Func<…> complexPropertySelector, string aliasName = null)methodSelects a nested collection field and its sub-selection.
x => x.Tasks.alias: field.selector; leave unset.…<T> AddField<TProperty, TArguments>(Func<T, IEnumerable<TProperty>> selector, TArguments arguments, Func<…> complexPropertySelector, string aliasName = null)methodSelects a nested collection field carrying its own arguments, plus its sub-selection.
x => x.Tasks.alias: field.selector; leave unset.…<T> AddEveryFields()methodSelects every scalar and enum property of T.
Variables
The variable value types.
GraphQLVariable
A reference to a declared GraphQL variable, produced by GraphQL.Var. Pass it inside an arguments object to render $name.
GraphQLParameter
A declared GraphQL variable: its name, value, and (optionally) explicit type. A null Type means the type is inferred from the value.
GraphQLParameterType
Explicit GraphQL type of a variable, used by the AddVariable(name, type, value) overload.
INTFLOATSTRINGBOOLEANDATETIMEUUID
INT_ARRAYFLOAT_ARRAYSTRING_ARRAYDATETIME_ARRAYOBJECT
Request
Sending and receiving.
GraphQLRequest
A GraphQL request payload: the query document and its variables. Read it straight off the builder via builder.Request.
GraphQLRequestData<T>
Envelope for deserializing a GraphQL response's data field into T.
Base types
Shared foundations — rarely used directly.
GraphQLObject
Base for anything that has a name, an optional alias, arguments and a nested field selection.
abstract GraphQLBuilderabstractBase builder holding the declared variables shared by query and mutation builders.
abstract GraphQLQueryObjectabstractNon-generic base for root query objects, so a builder can hold queries of different types.