示例#1
0
        /// <summary>
        /// Performs final configuration on graphql and preparses any referenced types for their meta data.
        /// Will NOT attempt to register an HTTP for the schema.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        public void UseSchema(IServiceProvider serviceProvider)
        {
            // pre-parse any types known to this schema
            var preCacher = new SchemaPreCacher();

            preCacher.PrecacheTemplates(_options.RegisteredSchemaTypes);
        }
示例#2
0
        /// <summary>
        /// Invoke the schema, performing final setup and configuration.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <param name="invokeAdditionalOptions">if set to <c>true</c> any configured, additional
        /// schema options on this instance are invoked with just the service provider.</param>
        private void UseSchema(IServiceProvider serviceProvider, bool invokeAdditionalOptions)
        {
            // pre-parse any types known to this schema
            var preCacher = new SchemaPreCacher();

            preCacher.PrecacheTemplates(_options.RegisteredSchemaTypes);

            // only when the service provider is used for final configuration do we
            // invoke extensions with just the service provider
            // (mostly just for test harnessing, but may be used by developers as well)
            if (invokeAdditionalOptions)
            {
                foreach (var additionalOptions in _options.Extensions)
                {
                    additionalOptions.Value.UseExtension(serviceProvider: serviceProvider);
                }
            }
        }