Dmi*_*riy 5 c# protobuf-net grpc asp.net-core
我正在尝试为我的项目创建 gRPC 服务。我有一堂课:
public class ServiceObject
{
public bool IsValuable { get; set; }
public bool IsValid { get; set; }
public object Result { get; set; }
public string ResultCode { get; set; }
public Exception Exception { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想从服务接收的对象。
我已经从谷歌阅读了 gRPC/Protobuf 的规范,但不明白如何做到这一点 - 我不知道如何传递object像Exception.
其他问题。让我们学习LocationGoogleApi C# 库中的类。
public class Location
{
public Location();
public Location(string address);
public Location(double latitude, double longitude);
[JsonProperty("lat")]
public double Latitude { get; set; }
[JsonProperty("lng")]
public double Longitude { get; set; }
public string Address { get; set; }
public override string ToString();
}
Run Code Online (Sandbox Code Playgroud)
如何从.proto我想要用于与服务通信的类自动生成文件?
谢谢。
| 归档时间: |
|
| 查看次数: |
2834 次 |
| 最近记录: |