public ServiceApiDescriptionProvider(
     IEnumerable <IInvocationSerializer> invocationSerializers,
     IContractBinder contractBinder)
 {
     this.invocationSerializers = invocationSerializers;
     this.contractBinder        = contractBinder;
 }
        public static void MapBlazorCommunicationFoundation(this IEndpointRouteBuilder endpoints)
        {
            IServiceProvider serviceProvider = endpoints.ServiceProvider;
            IContractBinder  contractBinder  = serviceProvider.GetRequiredService <IContractBinder>();

            foreach (var binding in contractBinder.GetBindings())
            {
                endpoints.MapPost(binding.Key, httpContext =>
                {
                    var invocationHandler = serviceProvider.GetRequiredService <ContractMethodInvocationHandler>();

                    return(invocationHandler.Invoke(httpContext, binding.Value));
                });
            }
        }