Beispiel #1
0
        /// <summary>
        /// Create an instance of <see cref="Schema"/> with a specified <see cref="IServiceProvider"/>, used
        /// to create required objects.
        /// </summary>
        public Schema(IServiceProvider services)
        {
            _services = services;

            _converters = new List <IAstFromValueConverter>();

            Directives = new SchemaDirectives();
            Directives.Register(DirectiveGraphType.Include, DirectiveGraphType.Skip, DirectiveGraphType.Deprecated);
            RegisterVisitor(DeprecatedDirectiveVisitor.Instance);
        }
Beispiel #2
0
        public Schema(IServiceProvider services, IEnumerable <IConfigureSchema> configurations)
        {
            _services = services;

            Directives = new SchemaDirectives();
            Directives.Register(Directives.Include, Directives.Skip, Directives.Deprecated);

            if (configurations != null)
            {
                foreach (var configuration in configurations)
                {
                    configuration.Configure(this, services);
                }
            }
        }
Beispiel #3
0
        public Schema(IServiceProvider services, bool runConfigurations = true)
        {
            _services = services;

            Directives = new SchemaDirectives();
            Directives.Register(Directives.Include, Directives.Skip, Directives.Deprecated);

            if (runConfigurations)
            {
                if (services.GetService(typeof(IEnumerable <IConfigureSchema>)) is IEnumerable <IConfigureSchema> configurations)
                {
                    foreach (var configuration in configurations)
                    {
                        configuration.Configure(this, services);
                    }
                }
            }
        }