Пример #1
0
 public override async Task AllRooms(Protos.AllRoomsRequest request, IServerStreamWriter <AllRoomsResponse> responseStream, ServerCallContext context)
 {
     foreach (var item in _serviceContract.AllRooms())
     {
         var response = new Protos.AllRoomsResponse {
             Value = item
         };
         await responseStream.WriteAsync(response);
     }
 }
Пример #2
0
 public override async Task AllRooms(Protos.AllRoomsRequest request, IServerStreamWriter <AllRoomsResponse> responseStream, ServerCallContext context)
 {
     try
     {
         foreach (var item in _serviceContract.AllRooms())
         {
             var response = new Protos.AllRoomsResponse {
                 Value = (Protos.Room)item
             };
             await responseStream.WriteAsync(response);
         }
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, "Error invoking AllRooms");
         throw new RpcException(new Status(StatusCode.Internal, ex.Message));
     }
 }