'Pass a parameter by reference in protobuf
I am writing a proto file for implementing a gRPC service and its contract needs to be the same as one of my existing WCF services. The WCF service has an operation contract that is defined as below:
[OperationContract]
public ResponseObject Calculate(string value, ref List<string> warnings)
I am trying to do the same implementation in protobuf. This is what I have as the rpc and message:
rpc Calculate(RequestMessage) returns (ResponseObject)
message RequestMessage{
string value = 1;
repeated string warnings = 2;
//there is no equivalent to pass by reference types 'ref'
}
As you can see above, I know that we can use the repeated type in protobuf to represent a List, but is there a supported way to use a pass by reference to a type? In the above operation, I have to do calculations and update the referenced list directly. Is there a way to do something similar in protobuf? I tried to go through the documents but did not find a way to do this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
