public void OnServiceMethodDiscovery(ServiceMethodProviderContext <GenericService> context)
 {
     context.AddDuplexStreamingMethod(
         GenericService.StreamingCallMethod,
         new List <object>(),
         GenericService.DuplexStreamingServerMethod);
 }
        public override void AddMethod <TRequest, TResponse>(Method <TRequest, TResponse> method, DuplexStreamingServerMethod <TRequest, TResponse> handler)
        {
            var(invoker, metadata) = CreateModelCore <DuplexStreamingServerMethod <TService, TRequest, TResponse> >(
                method.Name,
                new[] { typeof(IAsyncStreamReader <TRequest>), typeof(IServerStreamWriter <TResponse>), typeof(ServerCallContext) });

            _context.AddDuplexStreamingMethod <TRequest, TResponse>(method, metadata, invoker);
        }
Beispiel #3
0
        public void AddDuplexStreamingMethod <TRequest, TResponse>(
            Method <TRequest, TResponse> method,
            IList <object> metadata,
            Func <TService, IAsyncStreamReader <TRequest>, IServerStreamWriter <TResponse>, ServerCallContext, Task> handler)
            where TRequest : class
            where TResponse : class
        {
            var invoker = handler.Method.CreateDelegate <DuplexStreamingServerMethod <TService, TRequest, TResponse> >(handler.Target);

            _context.AddDuplexStreamingMethod(method, metadata, invoker);
        }
 public override void AddMethod <TRequest, TResponse>(Method <TRequest, TResponse> method, DuplexStreamingServerMethod <TRequest, TResponse> handler)
 {
     var(invoker, metadata) = CreateModelCore <DuplexStreamingServerMethod <TService, TRequest, TResponse> >(
         method.Name,
         new[] { typeof(IAsyncStreamReader <TRequest>), typeof(IServerStreamWriter <TResponse>), typeof(ServerCallContext) });
     if (_isIGrpcService)
     {
         _context.AddDuplexStreamingMethod <TRequest, TResponse>(method, metadata, invoker);
     }
     AddMetaMethod((new MetaMethodModel
     {
         FullName = method.FullName,
         RequestType = typeof(TRequest),
         ResponseType = typeof(TResponse),
         ServiceType = typeof(TService),
         Handler = invoker
     }));
 }
 public override void AddMethod <TRequest, TResponse>(Method <TRequest, TResponse> method, DuplexStreamingServerMethod <TRequest, TResponse> handler)
 {
     _context.AddDuplexStreamingMethod(method, Array.Empty <object>(), (_, request, stream, context) => handler(request, stream, context));
 }
Beispiel #6
0
 public override void AddMethod <TRequest, TResponse>(Method <TRequest, TResponse> method, DuplexStreamingServerMethod <TRequest, TResponse> handler)
 {
     var(invoker, metadata) = CreateModelCore <DuplexStreamingServerMethod <TService, TRequest, TResponse> >(method.Name);
     _context.AddDuplexStreamingMethod <TRequest, TResponse>(method, metadata, invoker);
 }