Beispiel #1
0
        public static IRequestExecutorBuilder AddAccountTypes(this IRequestExecutorBuilder builder)
        {
            builder.ModifyOptions(x => x.SortFieldsByName = true);

            builder
            .AddMutationType <AccountMutations>();


            var options = new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true
            };


            builder.UseField(next => async context =>
            {
                try
                {
                    await next(context);
                }
                catch (AccountException ex)
                {
                    context.ReportError(ErrorBuilder.New()
                                        .SetCode(ex.Code)
                                        .SetMessage(ex.Message)
                                        .Build());
                }
            });


            builder
            .AddType <CreateUserInputType>();

            builder.BindRuntimeType <Guid, IdType>();

            return(builder);
        }
 /// <summary>
 /// Configures the schema to remove types that cannot be reached by the execution engine.
 /// </summary>
 /// <param name="builder">
 /// The <see cref="IRequestExecutorBuilder"/>.
 /// </param>
 /// <param name="trim">
 /// A boolean defining if type trimming shall be applied.
 /// </param>
 /// <returns>
 /// Returns <see cref="IRequestExecutorBuilder"/> so that configurations can be chained.
 /// </returns>
 public static IRequestExecutorBuilder TrimTypes(
     this IRequestExecutorBuilder builder,
     bool trim = true) =>
 builder.ModifyOptions(o => o.RemoveUnreachableTypes = trim);