コード例 #1
0
ファイル: Schema.cs プロジェクト: mohdagung/graphql-dotnet
        /// <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;

            Directives = new SchemaDirectives();
            Directives.Register(Directives.Include, Directives.Skip, Directives.Deprecated);
        }
コード例 #2
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);
        }
コード例 #3
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);
                }
            }
        }
コード例 #4
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);
                    }
                }
            }
        }