gRPC services in C#
Before we implement the gRPC service in our project, we need to understand how the implementation can be done in .NET projects in general.
Two ways of implementing
When we want to implement gRPC services in the .NET project, we have two options. The Code-First method, where we decorate the C# classes with attributes, and the standard way using .proto
files. Let’s start with the Code-First method.
Code-First
This method uses C# contracts: classes and interfaces in C# with attribute decoration. The advantage of this approach is that you do not need to learn any language other than C# and if you already have defined your models and interfaces, you can just decorate them instead of creating new models.
The main disadvantage, however, is that this approach is only useful if you plan to stay in the .NET technologies and you do not need to share the gRPC service definitions with other languages.
The Code-First method requires a NuGet package called...