public static IServiceCollection AddGraphQLWithName( this IServiceCollection services, string schemaName, ISchema schema, Action <IQueryExecutionBuilder> build) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (schema == null) { throw new ArgumentNullException(nameof(schema)); } if (build == null) { throw new ArgumentNullException(nameof(build)); } QueryExecutionBuilder builder = QueryExecutionBuilder.New(); build(builder); builder.Populate(schemaName, services); return(services.AddSchema(schemaName, schema) .AddBatchQueryExecutor(schemaName)); }
public static IServiceCollection AddGraphQLWithName( this IServiceCollection services, string schemaName, Action <ISchemaConfiguration> configure, Action <IQueryExecutionBuilder> build) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } if (build == null) { throw new ArgumentNullException(nameof(build)); } QueryExecutionBuilder builder = QueryExecutionBuilder.New(); build(builder); builder.Populate(schemaName, services); return(services.AddSchema(schemaName, s => Schema.Create(c => { c.RegisterServiceProvider(s); configure(c); })) .AddBatchQueryExecutor(schemaName)); }
public static IServiceCollection AddGraphQL( this IServiceCollection services, string schemaSource, Action <ISchemaConfiguration> configure, Action <IQueryExecutionBuilder> build) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (string.IsNullOrEmpty(schemaSource)) { throw new ArgumentNullException(nameof(schemaSource)); } if (configure == null) { throw new ArgumentNullException(nameof(configure)); } if (build == null) { throw new ArgumentNullException(nameof(build)); } QueryExecutionBuilder builder = QueryExecutionBuilder.New(); build(builder); builder.Populate(services); return(services.AddGraphQLWithName(string.Empty, schemaSource, configure, build)); }
public static IServiceCollection AddGraphQL( this IServiceCollection services, Func <IServiceProvider, ISchema> schemaFactory, Action <IQueryExecutionBuilder> build) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (schemaFactory == null) { throw new ArgumentNullException(nameof(schemaFactory)); } if (build == null) { throw new ArgumentNullException(nameof(build)); } QueryExecutionBuilder builder = QueryExecutionBuilder.New(); build(builder); builder.Populate(services); return(services.AddSchema(schemaFactory) .AddSingleton <IBatchQueryExecutor, BatchQueryExecutor>()); }