/// <summary>
        /// Maps incoming requests to the specified <typeparamref name="TService"/> type.
        /// </summary>
        /// <typeparam name="TService">The service type to map requests to.</typeparam>
        /// <typeparam name="TEndpointBinder">The <see cref="IServiceEndpointBinder{TService}"/> to build endpoint.</typeparam>
        /// <param name="builder">The <see cref="IEndpointRouteBuilder"/> to add the route to.</param>
        /// <returns>A <see cref="GrpcServiceEndpointConventionBuilder"/> for endpoints associated with the service.</returns>
        public static GrpcServiceEndpointConventionBuilder MapGrpcService <TService, TEndpointBinder>(this IEndpointRouteBuilder builder)
            where TService : class
            where TEndpointBinder : IServiceEndpointBinder <TService>, new()
        {
            builder.AssertNotNull(nameof(builder));

            var options = builder.ServiceProvider.GetRequiredService <IOptions <ServiceModelGrpcServiceOptions <TService> > >();

            options.Value.EndpointBinderType = typeof(TEndpointBinder);

            return(builder.MapGrpcService <TService>());
        }