示例#1
0
        private async Task Handler(ServerCallContext context, Func <Task> func)
        {
            _processor.BeginRequest(context);
            try
            {
                await func();

                _processor.EndRequest(context);
            }
            catch (Exception ex)
            {
                _processor.DiagnosticUnhandledException(ex);
                throw;
            }
        }
示例#2
0
        public override async Task <TResponse> UnaryServerHandler <TRequest, TResponse>(TRequest request, ServerCallContext context, UnaryServerMethod <TRequest, TResponse> continuation)
        {
            _processor.BeginRequest(context);
            try
            {
                var response = await continuation(request, context);

                _processor.EndRequest(context);
                return(response);
            }
            catch (Exception ex)
            {
                _processor.DiagnosticUnhandledException(ex);
                throw ex;
            }
        }