/// <summary>
        /// Enables a PlaygroundServer using the specified settings
        /// </summary>
        /// <param name="applicationBuilder"></param>
        /// <param name="settings">The settings of the Middleware</param>
        /// <returns></returns>
        public static IApplicationBuilder UsePlaygroundServer(this IApplicationBuilder applicationBuilder, PlaygroundMiddlewareSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            applicationBuilder.UseMiddleware <PlaygroundMiddleware>(settings);
            return(applicationBuilder);
        }
예제 #2
0
 public PlaygroundPageModel(PlaygroundMiddlewareSettings settings)
 {
     this.settings = settings;
 }
예제 #3
0
        /// <summary>
        /// Enables a GraphQL using the specified settings
        /// </summary>
        /// <param name="applicationBuilder"></param>
        /// <param name="graphQLMiddlewareSettings">The settings of the <see cref="GraphQLMiddleware"/></param>
        /// <param name="graphiQLMiddlewareSettings">The settings of the <see cref="GraphiQLMiddleware"/></param>
        /// <param name="playgroundMiddlewareSettings">The settings of the <see cref="PlaygroundMiddleware"/></param>
        /// <returns></returns>
        public static IApplicationBuilder UseGraphQL(this IApplicationBuilder applicationBuilder, GraphQLMiddlewareSettings graphQLMiddlewareSettings, GraphiQLMiddlewareSettings graphiQLMiddlewareSettings, PlaygroundMiddlewareSettings playgroundMiddlewareSettings)
        {
            if (graphQLMiddlewareSettings == null)
            {
                throw new ArgumentNullException(nameof(graphQLMiddlewareSettings));
            }
            if (graphiQLMiddlewareSettings == null)
            {
                throw new ArgumentNullException(nameof(graphiQLMiddlewareSettings));
            }
            if (playgroundMiddlewareSettings == null)
            {
                throw new ArgumentNullException(nameof(playgroundMiddlewareSettings));
            }

            applicationBuilder.UseGraphQLServer(graphQLMiddlewareSettings);
            applicationBuilder.UseGraphiQLServer(graphiQLMiddlewareSettings);
            applicationBuilder.UsePlaygroundServer(playgroundMiddlewareSettings);
            return(applicationBuilder);
        }