Exemple #1
0
        public RequestHandler(
            IArgumentBinder <RequestInfo> argumentBinder,
            IDelegateMapper <RequestInfo> delegateMapper,
            IResponseComposer responseComposer,
            IEnumerable <IPreRequestHandler> preRequestHandlers,
            IEnumerable <IPostRequestHandler> postRequestHandlers,
            IEnumerable <IModelTransformer> modelTransformers)
        {
            if (argumentBinder == null)
            {
                throw new ArgumentNullException("argumentBinder");
            }

            if (delegateMapper == null)
            {
                throw new ArgumentNullException("delegateMapper");
            }

            if (responseComposer == null)
            {
                throw new ArgumentNullException("responseComposer");
            }

            _responseComposer            = responseComposer;
            _argumentBinder              = argumentBinder;
            _handlerMapper               = delegateMapper;
            _preRequestHandlers          = new List <IPreRequestHandler>();
            _postRequestHandlers         = new List <IPostRequestHandler>();
            _authenticationProviders     = new List <IPreRequestHandler>();
            _modelTransformers           = modelTransformers ?? new IModelTransformer[0];
            _defaultAuthenticationScheme = Initialize(preRequestHandlers, postRequestHandlers);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OperationResolver"/> class.
 /// </summary>
 /// <param name="operation">The <see cref="GraphOperationDescriptor"/> describing the current GraphQL operation.</param>
 /// <param name="binderProvider">The <see cref="IArgumentBinderProvider"/> to provide <see cref="IArgumentBinder"/>.</param>
 public OperationResolver(GraphOperationDescriptor operation, IArgumentBinderProvider binderProvider)
 {
     _operation = operation ?? throw new ArgumentNullException(nameof(operation));
     _executor  = ObjectMethodExecutor.Create(_operation.MethodInfo, _operation.Service.ServiceType.GetTypeInfo());
     _binder    = Guard.ArgumentNotNull(binderProvider, nameof(binderProvider)).GetArgumentBinder();
 }