public KestrelHostingService(
            KestrelHostingServiceOptions options,
            StatelessServiceContext serviceContext,
            ILoggerFactory factory,
            IUnityContainer container)
            : base(serviceContext)
        {
            Options   = options;
            Container = container;
            _logger   = factory.CreateLogger <KestrelHostingService>();

            _logger.LogInformation("Creating " + nameof(KestrelHostingService) + " for {@options}", Options);
        }
 public static IUnityContainer WithKestrelHosting <THostingService, TStartup>(this IUnityContainer container, string serviceType, KestrelHostingServiceOptions options)
     where THostingService : KestrelHostingService <TStartup>
     where TStartup : class
 {
     container.WithStatelessService <THostingService>(serviceType, child => { child.RegisterInstance(options); });
     return(container);
 }
 public static IUnityContainer WithKestrelHosting <TStartup>(this IUnityContainer container, string serviceType, KestrelHostingServiceOptions options)
     where TStartup : class
 {
     return(container.WithKestrelHosting <KestrelHostingService <TStartup>, TStartup>(serviceType, options));
 }
        public static IUnityContainer WithKestrelHosting(this IUnityContainer container, string serviceType, KestrelHostingServiceOptions options, Action <IWebHostBuilder> builder)
        {
            container.WithStatelessService <KestrelHostingService>(serviceType, child =>
            {
                child.RegisterInstance(options);
                child.RegisterType <KestrelHostingService>(new InjectionProperty("WebBuilderConfiguration", builder));
            });

            return(container);
        }