I'm new to Protobuf and understand that there isn't a way to model an interface implementation in Protobuf. We have an existing set of domain objects that implements a common "IBase" interface in C#.
One option is to use the protobuf generated class only as a DTO and convert it in to the domain class after deserialization but that would mean I will need to create a separate DTO class which I use in .proto and convert it to domain class after deserialization
I would like to model the DerivedProduct class in proto and generate the client and server classes in C# and Java respectively. Please advise on the best practice to model existing interface implementations like below. I have provided a simple representation below.
interface IBase
{
string ProductName {get;set;}
void Add(string baseProduct);
}
interface IDerived: IBase
{
double ProductRate {get;set;}
}
class DerivedProduct : IDerived
{
string ProductName {get;set;}
void Add(string baseProduct){ }
double ProductRate {get;set;}
}