Skip to the content.

< Back


GraphQLDirective

Namespace: GraphQL.Query.Builder

Represents a GraphQL directive (e.g., @include, @skip).

public class GraphQLDirective

Inheritance ObjectGraphQLDirective
Attributes NullableContextAttribute, NullableAttribute

Properties

Name

Gets the directive name (without the @ prefix).

public string Name { get; }

Property Value

String

Arguments

Gets the directive arguments.

public Dictionary<string, object?> Arguments { get; }

Property Value

Dictionary<String, Object>

Constructors

GraphQLDirective(String)

Initializes a new instance of the GraphQLDirective class without arguments.

public GraphQLDirective(string name)

Parameters

name String
The directive name (without the @ prefix).

Exceptions

ArgumentException
The name is not a valid GraphQL name.

GraphQLDirective(String, Dictionary<String, Object>)

Initializes a new instance of the GraphQLDirective class with arguments.

public GraphQLDirective(string name, Dictionary<string, object?> arguments)

Parameters

name String
The directive name (without the @ prefix).

arguments Dictionary<String, Object>
The directive arguments.

Exceptions

ArgumentException
The name or one of the argument names is not a valid GraphQL name.

Methods

Include(GraphQLVariableReference)

Creates an @include directive.

public static GraphQLDirective Include(GraphQLVariableReference ifVar)

Parameters

ifVar GraphQLVariableReference
The variable reference for the if argument.

Returns

GraphQLDirective
A new @include directive.

Skip(GraphQLVariableReference)

Creates a @skip directive.

public static GraphQLDirective Skip(GraphQLVariableReference ifVar)

Parameters

ifVar GraphQLVariableReference
The variable reference for the if argument.

Returns

GraphQLDirective
A new @skip directive.


< Back