Path: redb-route/redb.Route.Grpc/Extensions/ServiceCollectionExtensions.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Grpc/Extensions/ServiceCollectionExtensions.cs ---- using Microsoft.Extensions.DependencyInjection; using redb.Route.Extensions; using redb.Route.Http; namespace redb.Route.Grpc; /// /// Extension methods for registering the gRPC component with dependency injection. /// public static class ServiceCollectionExtensions { /// /// Registers the gRPC component with the route context. /// public static IServiceCollection AddRedbRouteGrpc(this IServiceCollection services) { // gRPC serves on the shared Kestrel host, same as Http, As2 and Soap. Idempotent, so calling // several transport registrations in one host still yields one server manager. services.AddRedbRouteHttpHosting(); services.AddSingleton(); // IRouteContextConfigurator is applied by RouteHostedService at startup -- // the correct registration hook (a lazy marker singleton never fires). services.AddRouteContextConfigurator((sp, context) => { var component = sp.GetRequiredService(); component.ServerManager = sp.GetRequiredService(); context.AddComponent(component); }); return services; } }