Class ValueObjectRequestExecutorBuilderExtensions
Namespace: AdCodicem.ValueObjects.HotChocolate
Assembly: AdCodicem.ValueObjects.HotChocolate.dll
Maps value objects to GraphQL scalars of their own in a HotChocolate schema, read through their rules.
public static class ValueObjectRequestExecutorBuilderExtensions
Inheritance
object ← ValueObjectRequestExecutorBuilderExtensions
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods
AddValueObjectScalar<TSelf, TValue>(IRequestExecutorBuilder, string?)
Maps one value object to its scalar, closed at compile time: a construction of a generic value object, or one written by hand, under native AOT.
public static IRequestExecutorBuilder AddValueObjectScalar<TSelf, TValue>(this IRequestExecutorBuilder builder, string? name = null) where TSelf : struct, IValueObject<TSelf, TValue>
Parameters
builder IRequestExecutorBuilder
The schema's builder.
name string?
The name of the scalar, a GraphQL name, or null to take the one
Returns
IRequestExecutorBuilder
builder, so calls can be chained.
Type Parameters
TSelf
The value object type.
TValue
Its underlying type.
Remarks
The scalar binds implicitly to TSelf, so that the schema uses it wherever the type appears,
beside TSelf, never through the registry.
Exceptions
builder is null.
name is empty or white space.
AddValueObjects(IRequestExecutorBuilder, Action<ValueObjectScalarOptions>?)
Maps every value object the schema meets to a scalar of its own, which reads a value through the type's rules.
public static IRequestExecutorBuilder AddValueObjects(this IRequestExecutorBuilder builder, Action<ValueObjectScalarOptions>? configure = null)
Parameters
builder IRequestExecutorBuilder
The schema's builder, from AddGraphQL() or AddGraphQLServer().
configure Action<ValueObjectScalarOptions>?
Names, specifications and messages of the scalars, or null for none.
Returns
IRequestExecutorBuilder
builder, so calls can be chained.
Remarks
A type discovery handler, asked before HotChocolate's own, answers each value object the schema references, as an
argument, an input field, a field or the element of a list, with a TSelf? is the nullable scalar. A value object the registry
holds is closed at compile time; one it does not hold yet, a construction of a generic value object or a value
object written by hand, is described by ValueObjectRegistry.TryResolve where the runtime supports dynamic
code, and refused with a ValueObjectRegistry.Register and
Every call on one schema configures the same
The first call also adds an error filter, which localizes a refusal under
Exceptions
builder is null.