예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TResponse"></typeparam>
        /// <param name="streamWriter"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        private IServerStreamWriter <TResponse> CreateServerStreamWriter <TResponse>(IServerStreamWriter <TResponse> streamWriter, ServerCallContext context)
            where TResponse : class
        {
            Task onWrite(IServerStreamWriter <TResponse> writer, TResponse response)
            {
                async Task func(TResponse res)
                {
                    await writer.WriteAsync(res).ConfigureAwait(false);
                }

                return(InterceptServerWriteResponse(func, response, context));
            }

            return(streamWriter.Wrap(onWrite));
        }