예제 #1
0
        public void AddUnaryMethod <TRequest, TResponse>(
            Method <TRequest, TResponse> method,
            IList <object> metadata,
            Func <TService, TRequest, ServerCallContext, Task <TResponse> > handler)
            where TRequest : class
            where TResponse : class
        {
            var invoker = new UnaryServerCallHandler <TService, TRequest, TResponse>(_serviceFactory, handler);

            _builder.AddMethod(method, invoker.Handle);
        }
예제 #2
0
        public void AddUnaryMethod <TRequest, TResponse>(
            Method <TRequest, TResponse> method,
            Func <MethodInfo> resolveContractMethodDefinition,
            IList <object> metadata,
            Func <TService, TRequest, ServerCallContext, Task <TResponse> > handler)
            where TRequest : class
            where TResponse : class
        {
            var filterHandlerFactory = _filterRegistration.CreateHandlerFactory(metadata, resolveContractMethodDefinition);

            ValidateFilterFactoryConfiguration(filterHandlerFactory);

            var invoker = new UnaryServerCallHandler <TService, TRequest, TResponse>(_serviceFactory, handler, filterHandlerFactory);

            _builder.AddMethod(method, invoker.Handle);
        }