Implementing gRPC for an EF Core model
Now we will add a service for working with the Northwind database to the gRPC project.
Implementing the gRPC service
We will reference the EF Core model that you created in Chapter 2, Managing Relational Data Using SQL Server, then define a contract for the gRPC service using a .proto
file, and finally implement the service:
- In the
Northwind.Grpc.Service
project, add a project reference to the Northwind database context project, as shown in the following markup:<ItemGroup> <ProjectReference Include="..\..\Chapter02\Northwind.Common.DataContext .SqlServer\Northwind.Common.DataContext.SqlServer.csproj" /> </ItemGroup>
The
Include
path must not have a line break.
- At the command line or terminal, build the
Northwind.Grpc.Service
project. - In the
Northwind.Grpc.Service
project, in theProtos
folder, add a new file (the item template is named Protocol...