/// <inheritdoc />
        public void Initialize()
        {
            LoggerManagement.ActivateLogging(this);

            _container  = new LocalContainer();
            _portConfig = ConfigManager.GetConfiguration <PortConfig>();

            _container.Register <IVersionService, VersionService>(nameof(VersionService), LifeCycle.Transient);
            _container.Register <EndpointCollector, EndpointCollector>();
            var collector = _container.Resolve <EndpointCollector>();

            _container.Extend <WcfFacility>();
            _container.Register <ITypedHostFactory, TypedHostFactory>();

            var factory = _container.Resolve <ITypedHostFactory>();

            var host       = new ConfiguredServiceHost(factory, Logger, collector, _portConfig);
            var hostConfig = new HostConfig
            {
                Endpoint        = "endpoints",
                MetadataEnabled = true
            };

            host.Setup(typeof(IVersionService), hostConfig);
            host.Start();
        }
        /// <inheritdoc />
        public IConfiguredServiceHost CreateHost <T>(HostConfig config, ITypedHostFactory hostFactory, IModuleLogger logger)
        {
            var collector = _container.Resolve <IEndpointCollector>();

            // Create instance and fill using given container
            var host = new ConfiguredServiceHost(hostFactory, logger, collector, _portConfig);

            host.Setup <T>(config);

            return(host);
        }
        /// <inheritdoc />
        public void Initialize()
        {
            LoggerManagement.ActivateLogging(this);

            _container = new LocalContainer();
            var factoryConfig = ConfigManager.GetConfiguration <HostFactoryConfig>();

            _portConfig = ConfigManager.GetConfiguration <PortConfig>();

            // In minimal core setups with no WCF service this can be disabled
            if (factoryConfig.VersionServiceDisabled)
            {
                return;
            }

            var hostConfig = new HostConfig
            {
                BindingType     = ServiceBindingType.BasicHttp,
                Endpoint        = "ServiceVersions",
                MetadataEnabled = true
            };

            _container.Register <IVersionService, VersionService>(nameof(VersionService), LifeCycle.Transient);
            _container.Register <IEndpointCollector, EndpointCollector>();
            var collector = _container.Resolve <IEndpointCollector>();

            _container.Extend <WcfFacility>();
            _container.Register <ITypedHostFactory, TypedHostFactory>();

            var factory = _container.Resolve <ITypedHostFactory>();
            var host    = new ConfiguredServiceHost(factory, Logger, collector, _portConfig);

            host.Setup <IVersionService>(hostConfig);
            host.Start();

            hostConfig = new HostConfig
            {
                Endpoint        = "ServiceVersionsWeb",
                MetadataEnabled = true
            };

            host = new ConfiguredServiceHost(factory, Logger, collector, _portConfig);
            host.Setup <IVersionService>(hostConfig);
            host.Start();
        }