We want to migrate our project from grpc.core to gprc-dotnet. In my grpc server I reference the packages Grpc.AspNetCore. The proto file is compiled in a different project and shared. When I implement my server method like:
**using Grpc.Core;**
using Sample.Shared;
namespace Sample.GrpcServer.Services;
public class CustomerService : CustomerGrpcService.CustomerGrpcServiceBase
{
private readonly ILogger<CustomerService> _logger;
public CustomerService(ILogger<CustomerService> logger)
{
_logger = logger;
}
public override Task<CustomerListResponse> GetCustomerList(CustomerListRequest request, ServerCallContext context)
{
...
}
The ServerCallContext class requires me to import Grpc.Core which I want to remove. How am I supposed to use grpc-dotnet to implement my overrides eg the ServerCallContext class?
It looks like ServerCallContext is implemented in the package Grpc.Core.Api which contains the namespace Grpc.Core. This is a little confusing but was probably implemented for backward compatibiliy. Perhaps somebody can comment on that. So the only thing really to do in this scenario is to use the correct nuget package Grpc.AspNetCore.Server. References to Grpc.Core will be pulled from this and underlying referenced assembly.