Current Grpc.AspNetCore.Server does not support ServerServiceDefinition.
This makes some obstacle for:
migration from Grpc.Core
integration with other external DI container
dynamic plugin injection
Then I propose new API:
public static class GrpcEndpointRouteBuilderExtensions
{
public static GrpcServiceEndpointConventionBuilder MapGrpcService(
this IEndpointRouteBuilder builder,
ServerServiceDefinition serviceDefinition)
=> throw new NotImplementedException();
public static GrpcServiceEndpointConventionBuilder MapGrpcService(
this IEndpointRouteBuilder builder,
Func<IServiceProvider, ServerServiceDefinition> getServiceDefinition)
=> throw new NotImplementedException();
}
NOTE: Conventional API can delay instantiation of service until RPC routing, but I think there is a limitation in new API that the service instance shall be instantiated at mapping immediately.
related to: #1628
Current Grpc.AspNetCore.Server does not support
ServerServiceDefinition
. This makes some obstacle for:Then I propose new API:
It looks that current implementation in this project is mismatch with the new APIs, then I implement these API experimentally on https://github.com/aka-nse/grpc-dotnet/tree/feature/MapGrpcService-with-ServerServiceDefinition. GreeterByServiceDefinition is a new sample solution for this API.
NOTE: Conventional API can delay instantiation of service until RPC routing, but I think there is a limitation in new API that the service instance shall be instantiated at mapping immediately.