QueryStringBuilder
Namespace: GraphQL.Query.Builder
The GraphQL query builder class.
public class QueryStringBuilder : IQueryStringBuilder
Inheritance Object → QueryStringBuilder
Implements IQueryStringBuilder
Attributes NullableContextAttribute, NullableAttribute
Fields
formatter
The property name formatter.
protected Func<PropertyInfo, string> formatter;
Properties
QueryString
The query string builder.
public StringBuilder QueryString { get; }
Property Value
Constructors
QueryStringBuilder()
Initializes a new instance of the QueryStringBuilder class.
public QueryStringBuilder()
QueryStringBuilder(Func<PropertyInfo, String>)
Initializes a new instance of the QueryStringBuilder class.
public QueryStringBuilder(Func<PropertyInfo, string> formatter)
Parameters
formatter
Func<PropertyInfo, String>
The property name formatter
Methods
Build<TSource>(IQuery<TSource>)
Builds the query.
public string Build<TSource>(IQuery<TSource> query)
Type Parameters
TSource
Parameters
query
IQuery<TSource>
The query.
Returns
String
The GraphQL query as string, without outer enclosing block.
Clear()
Clears the string builder.
public void Clear()
FormatQueryParam(Object)
Formats query param.
Returns:
- null -
null
- String -
"foo"
- Number -
10
- Boolean -
true
orfalse
- Enum -
EnumValue
- DateTime -
"2024-06-15T13:45:30.0000000Z"
- Key value pair -
foo:"bar"
orfoo:10
… - List -
["foo","bar"]
or[1,2]
… - Dictionary -
{foo:"bar",b:10}
- Object -
{foo:"bar",b:10}
protected internal string FormatQueryParam(object value)
Parameters
value
Object
Returns
String
The formatted query param.
Exceptions
InvalidDataException
Invalid Object Type in Param List
AddParams<TSource>(IQuery<TSource>)
Adds query params to the query string.
protected internal void AddParams<TSource>(IQuery<TSource> query)
Type Parameters
TSource
Parameters
query
IQuery<TSource>
The query.
AddFields<TSource>(IQuery<TSource>)
Adds fields to the query sting.
protected internal void AddFields<TSource>(IQuery<TSource> query)
Type Parameters
TSource
Parameters
query
IQuery<TSource>
The query.
Exceptions
ArgumentException
Invalid Object in Field List