ProtoInfo.cs 1007 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Grpc.Core;
  2. using ProtoBuf;
  3. using System.Collections.Concurrent;
  4. using System.Collections.Generic;
  5. namespace Grpc.Extension.BaseService.Model
  6. {
  7. public class ProtoInfo
  8. {
  9. /// <summary>
  10. /// grpc服务方法信息 用于生成proto文件
  11. /// </summary>
  12. public static List<ProtoMethodInfo> Methods { get; internal set; } = new List<ProtoMethodInfo>();
  13. }
  14. /// <summary>
  15. /// 注册到grpc的服务方法信息
  16. /// </summary>
  17. public class ProtoMethodInfo
  18. {
  19. public string ServiceName { get; set; }
  20. public string MethodName { get; set; }
  21. public string RequestName { get; set; }
  22. public string ResponseName { get; set; }
  23. public string FullName
  24. {
  25. get { return "/" + ServiceName + "/" + MethodName; }
  26. }
  27. public MethodType MethodType { get; set; }
  28. public static ConcurrentDictionary<string, string> Protos = new ConcurrentDictionary<string, string>();
  29. }
  30. }