Chapter 8: Using Well-Known Types to Make Protobuf More Handy
We learned in Chapter 3, Protobuf – the Communication Protocol of gRPC, that data types that are native to Protobuf cannot be null and must have the default value. The default value will be applied if you don't explicitly set the value in the code. For example, the default value for the string data type is an empty string value. The default value for any of the integer data types is 0. The default value for bool is false.
This presents a problem. Sometimes, you will be in a situation where you will need to distinguish between a value that has been deliberately set and a value that was automatically set to the default. For example, the count of 0 has a different meaning than "no data." ...
Get Microservices Communication in .NET Using gRPC now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.