GreeterService.cs 669 B

1234567891011121314151617181920212223242526
  1. using Grpc.Core;
  2. using Microsoft.Extensions.Logging;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Threading.Tasks;
  7. namespace XYY.gRpc.Customer
  8. {
  9. public class GreeterService : Greeter.GreeterBase
  10. {
  11. private readonly ILogger<GreeterService> _logger;
  12. public GreeterService(ILogger<GreeterService> logger)
  13. {
  14. _logger = logger;
  15. }
  16. public override Task<HelloReply> SayHello(HelloRequest request, ServerCallContext context)
  17. {
  18. return Task.FromResult(new HelloReply
  19. {
  20. Message = "Hello " + request.Name
  21. });
  22. }
  23. }
  24. }