Beispiel #1
0
        public override async Task GetScores(ScoresRequest request, IServerStreamWriter <ScoreResponse> responseStream,
                                             ServerCallContext context)
        {
            try
            {
                _auth.GetClient(context);
            }
            catch (GrpcError e)
            {
                await responseStream.WriteAsync(new ScoreResponse { ErrorNo = e.ErrorNumber });

                return;
            }

            var scores      = _service.GetScores();
            var protoScores = scores.Select(score => new ScoreResponse {
                Score = score.ToProto()
            });
            await responseStream.WriteAllAsync(protoScores);
        }