コード例 #1
0
        public void RegisterMiddleware(IDirectiveMiddleware middleware)
        {
            if (middleware == null)
            {
                throw new ArgumentNullException(nameof(middleware));
            }

            _middlewares[middleware.DirectiveName] = middleware;
        }
コード例 #2
0
        public void RegisterMiddleware(IDirectiveMiddleware middleware)
        {
            if (middleware == null)
            {
                throw new ArgumentNullException(nameof(middleware));
            }

            _schemaContext.Resolvers.RegisterMiddleware(middleware);
        }
コード例 #3
0
        private void Initialize(Action <IDirectiveTypeDescriptor> configure)
        {
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            DirectiveTypeDescriptor descriptor = CreateDescriptor();

            configure(descriptor);

            DirectiveTypeDescription description =
                descriptor.CreateDescription();

            ClrType     = description.ClrType;
            SyntaxNode  = description.SyntaxNode;
            Name        = description.Name;
            Description = description.Description;
            Locations   = description.Locations.ToList().AsReadOnly();
            Arguments   = new FieldCollection <InputField>(
                description.Arguments.Select(t => new InputField(t)));
            _middleware = description.Middleware;
        }