So I need to create a full .proto file with a service and messages to fully describe one of the services I'm going to use. I already found this post that mentions the use of
string proto = Serializer.GetProto<YourType>();
But sadly when used on my service it just generates a proto file with a "message" named after my service.
Talking with a the concrete file examples I give bellow, is there a way to get the Example.proto from the IExampleService.cs?
[ServiceContract]
public interface IExampleService
{
Task<ExampleReply> ExampleMethod(ExampleRequest request);
}
[ProtoContract]
public class ExampleRequest
{
[ProtoMember(1)]
public string Prop1 { get; set; }
[ProtoMember(2, DataFormat = DataFormat.WellKnown)]
public DateTime TimeProp2 { get; set; }
}
[ProtoContract]
public class ExampleReply
{
[ProtoMember(1)]
public string Prop1 { get; set; }
}
Example.proto file
service IExampleService {
rpc ExampleMethod (ExampleRequest) returns (ExampleReply) {}
}
message ExampleRequest{
string Prop1 = 1;
.google.protobuf.Timestamp TimeProp2 = 2;
}
message ExampleReply {
string message = 1;
}