示例#1
0
        /// <summary>
        /// Adds a client streaming method to a service.
        /// </summary>
        /// <typeparam name="TRequest">Request message type for this method.</typeparam>
        /// <typeparam name="TResponse">Response message type for this method.</typeparam>
        /// <param name="method">The method description.</param>
        /// <param name="metadata">The method metadata. This metadata can be used by routing and middleware when invoking a gRPC method.</param>
        /// <param name="invoker">The method invoker that is executed when the method is called.</param>
        public void AddClientStreamingMethod <TRequest, TResponse>(Method <TRequest, TResponse> method, IList <object> metadata, ClientStreamingServerMethod <TService, TRequest, TResponse> invoker)
            where TRequest : class
            where TResponse : class
        {
            var callHandler = _serverCallHandlerFactory.CreateClientStreaming <TRequest, TResponse>(method, invoker);

            AddMethod(method, RoutePatternFactory.Parse(method.FullName), metadata, callHandler.HandleCallAsync);
        }
示例#2
0
        /// <summary>
        /// Adds a client streaming method to a service.
        /// </summary>
        /// <typeparam name="TRequest">Request message type for this method.</typeparam>
        /// <typeparam name="TResponse">Response message type for this method.</typeparam>
        /// <param name="method">The method description.</param>
        /// <param name="metadata">The method metadata. This metadata can be used by routing and middleware when invoking a gRPC method.</param>
        /// <param name="invoker">The method invoker that is executed when the method is called.</param>
        public void AddClientStreamingMethod <TRequest, TResponse>(Method <TRequest, TResponse> method, List <object> metadata, ClientStreamingServerMethod <TService, TRequest, TResponse> invoker)
            where TRequest : class
            where TResponse : class
        {
            var callHandler = _serverCallHandlerFactory.CreateClientStreaming <TRequest, TResponse>(method, invoker);
            var methodModel = new MethodModel(method, metadata, callHandler.HandleCallAsync);

            Methods.Add(methodModel);
        }