public static HostConfigurator RehabService <T>(this HostConfigurator configurator, Func <HostSettings, T> factory)
            where T : class, ServiceControl
        {
            if (configurator == null)
            {
                throw new ArgumentNullException("configurator");
            }

            ServiceBuilderFactory serviceBuilderFactory = ServiceExtensions.CreateServiceBuilderFactory(factory,
                                                                                                        NoCallback);

            return(RehabService <T>(configurator, serviceBuilderFactory));
        }
        public static HostConfigurator RehabService <T>(this HostConfigurator configurator)
            where T : class, ServiceControl, new()
        {
            if (configurator == null)
            {
                throw new ArgumentNullException("configurator");
            }

            ServiceBuilderFactory serviceBuilderFactory = ServiceExtensions.CreateServiceBuilderFactory(x => new T(),
                                                                                                        NoCallback);

            return(RehabService <T>(configurator, serviceBuilderFactory));
        }
        public static SuperviseConfigurator Service <T>(this SuperviseConfigurator configurator, Func <T> serviceFactory)
            where T : class, ServiceControl
        {
            if (configurator == null)
            {
                throw new ArgumentNullException("configurator");
            }

            ServiceBuilderFactory serviceBuilderFactory =
                ServiceExtensions.CreateServiceBuilderFactory(x => serviceFactory(), NoCallback);

            configurator.UseServiceBuilder(serviceBuilderFactory);

            return(configurator);
        }
        public static SuperviseConfigurator Service <TService>(this SuperviseConfigurator configurator,
                                                               Action <ServiceConfigurator <TService> > callback)
            where TService : class
        {
            if (configurator == null)
            {
                throw new ArgumentNullException("configurator");
            }

            ServiceBuilderFactory serviceBuilderFactory = ServiceExtensions.CreateServiceBuilderFactory(callback);

            configurator.UseServiceBuilder(serviceBuilderFactory);

            return(configurator);
        }