public static IRequestExecutorBuilder AddTypeModule <T>(
            this IRequestExecutorBuilder builder)
            where T : ITypeModule
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.Configure((sp, c) => c.TypeModules.Add(sp.GetRequiredService <T>())));
        }
Beispiel #2
0
    public static IRequestExecutorBuilder SetSchema(
        IRequestExecutorBuilder builder,
        Func <IServiceProvider, ISchema> schemaFactory)
    {
        if (builder is null)
        {
            throw new ArgumentNullException(nameof(builder));
        }

        if (schemaFactory is null)
        {
            throw new ArgumentNullException(nameof(schemaFactory));
        }

        return(builder.Configure((s, o) => o.Schema = schemaFactory(s)));
    }
Beispiel #3
0
    public static IRequestExecutorBuilder SetSchema(
        IRequestExecutorBuilder builder,
        ISchema schema)
    {
        if (builder is null)
        {
            throw new ArgumentNullException(nameof(builder));
        }

        if (schema is null)
        {
            throw new ArgumentNullException(nameof(schema));
        }

        return(builder.Configure(options => options.Schema = schema));
    }
Beispiel #4
0
        public static IRequestExecutorBuilder ConfigureOnRequestExecutorCreatedAsync(
            this IRequestExecutorBuilder builder,
            Func <IServiceProvider, IRequestExecutor, CancellationToken, ValueTask> asyncAction)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (asyncAction == null)
            {
                throw new ArgumentNullException(nameof(asyncAction));
            }

            return(builder.Configure((s, o) => o.OnRequestExecutorCreated.Add(
                                         new OnRequestExecutorCreatedAction((e, ct) => asyncAction(s, e, ct)))));
        }
Beispiel #5
0
        public static IRequestExecutorBuilder ConfigureOnRequestExecutorCreated(
            this IRequestExecutorBuilder builder,
            Action <IServiceProvider, IRequestExecutor> action)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            return(builder.Configure((s, o) => o.OnRequestExecutorCreated.Add(
                                         new OnRequestExecutorCreatedAction(e => action(s, e)))));
        }
        public static IRequestExecutorBuilder AddTypeModule <T>(
            this IRequestExecutorBuilder builder,
            Func <IServiceProvider, T> factory)
            where T : ITypeModule
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            return(builder.Configure((sp, c) => c.TypeModules.Add(factory(sp))));
        }