示例#1
0
 /// <summary>
 /// Intercepts an asynchronous invocation of a duplex streaming call.
 /// </summary>
 /// <param name="context">
 /// The <see cref="Grpc.Core.Interceptors.ClientInterceptorContext{TRequest, TResponse}"/>
 /// associated with the current invocation.
 /// </param>
 /// <param name="continuation">
 /// The callback that continues the invocation process.
 /// This can be invoked zero or more times by the interceptor.
 /// The interceptor can invoke the continuation passing the given
 /// context argument, or substitute as it sees fit.
 /// </param>
 /// <returns>
 /// An instance of <see cref="Grpc.Core.AsyncDuplexStreamingCall{TRequest, TResponse}" />
 /// representing an asynchronous duplex-streaming invocation.
 /// The interceptor can simply return the return value of the
 /// continuation delegate passed to it intact, or construct its
 /// own substitute as it sees fit.
 /// </returns>
 public virtual AsyncDuplexStreamingCall <TRequest, TResponse> AsyncDuplexStreamingCall <TRequest, TResponse>(ClientInterceptorContext <TRequest, TResponse> context, AsyncDuplexStreamingCallContinuation <TRequest, TResponse> continuation)
     where TRequest : class
     where TResponse : class
 {
     return(continuation(context));
 }
示例#2
0
 /// <summary>
 /// Intercepts an asynchronous invocation of a simple remote call.
 /// </summary>
 /// <param name="request">The request message of the invocation.</param>
 /// <param name="context">
 /// The <see cref="Grpc.Core.Interceptors.ClientInterceptorContext{TRequest, TResponse}"/>
 /// associated with the current invocation.
 /// </param>
 /// <param name="continuation">
 /// The callback that continues the invocation process.
 /// This can be invoked zero or more times by the interceptor.
 /// The interceptor can invoke the continuation passing the given
 /// request value and context arguments, or substitute them as it sees fit.
 /// </param>
 /// <returns>
 /// An instance of <see cref="Grpc.Core.AsyncUnaryCall{TResponse}" />
 /// representing an asynchronous unary invocation.
 /// The interceptor can simply return the return value of the
 /// continuation delegate passed to it intact, or construct its
 /// own substitute as it sees fit.
 /// </returns>
 public virtual AsyncUnaryCall <TResponse> AsyncUnaryCall <TRequest, TResponse>(TRequest request, ClientInterceptorContext <TRequest, TResponse> context, AsyncUnaryCallContinuation <TRequest, TResponse> continuation)
     where TRequest : class
     where TResponse : class
 {
     return(continuation(request, context));
 }
示例#3
0
 public override AsyncUnaryCall <TResponse> AsyncUnaryCall <TRequest, TResponse>(TRequest request, ClientInterceptorContext <TRequest, TResponse> context, AsyncUnaryCallContinuation <TRequest, TResponse> continuation)
 {
     return(continuation(request, GetNewContext(context)));
 }
示例#4
0
 public override AsyncDuplexStreamingCall <TRequest, TResponse> AsyncDuplexStreamingCall <TRequest, TResponse>(ClientInterceptorContext <TRequest, TResponse> context, AsyncDuplexStreamingCallContinuation <TRequest, TResponse> continuation)
 {
     return(continuation(GetNewContext(context)));
 }
示例#5
0
            private ClientInterceptorContext <TRequest, TResponse> GetNewContext <TRequest, TResponse>(ClientInterceptorContext <TRequest, TResponse> context)
                where TRequest : class
                where TResponse : class
            {
                var metadata = context.Options.Headers ?? new Metadata();

                return(new ClientInterceptorContext <TRequest, TResponse>(context.Method, context.Host, context.Options.WithHeaders(interceptor(metadata))));
            }