示例#1
0
        public static ServerInfoHolder AddWebRpcServices(this IServiceCollection services, Action <ServerConfig> config)
        {
            var configHolder = new ServerInfoHolder();

            services.TryAddSingleton(configHolder);

            var configuration = new ServerConfig();

            config(configuration);

            RegisterServicesInContainer(services, configuration);

            //Create the container from the configuration..
            configHolder.Add(CreateServerInfo(configuration));

            //Adding support for OpenApiDoc
            services.TryAddSingleton <IApiDescriptionGroupCollectionProvider, ApiDescriptorGroupCollectionProvider>();
            services.TryAddSingleton <IActionDescriptorCollectionProvider, ApiDescriptorCollectionProvider>();
            services.TryAddEnumerable(ServiceDescriptor.Transient <IApiDescriptionProvider, ApiDescriptionProvider>());

            return(configHolder);
        }
示例#2
0
 public ApiDescriptorCollectionProvider(ServerInfoHolder serverInfo)
 {
     this.serverInfo = serverInfo;
 }
示例#3
0
 public ListSupportedInterfaces(RequestDelegate next, ServerInfoHolder serverInfos)
 {
     this.next        = next;
     this.serverInfos = serverInfos;
 }