public static void Run <THostedServiceProgram, TStartup>(IServiceProvider configurationServiceProvider)
     where THostedServiceProgram : class, IHostedService
     where TStartup : class, IStartup
 {
     HostServiceBuilder.New()
     .UseStartup <TStartup>()
     .UseHostedServiceProgram <THostedServiceProgram>()
     .Build(configurationServiceProvider)
     .Run()
     ;
 }
        public static void Run <THostedServiceProgram>()
            where THostedServiceProgram : HostedServiceProgramBase
        {
            var emptyServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

            var host = HostServiceBuilder.New()
                       .UseHostedServiceProgram <THostedServiceProgram>()
                       .Build(emptyServiceProvider)
            ;

            host.Run();
        }
        public static Task RunAsync <THostedServiceProgram>()
            where THostedServiceProgram : AsyncHostedServiceProgramBase
        {
            var emptyServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

            var host = HostServiceBuilder.New()
                       .UseHostedServiceProgram <THostedServiceProgram>()
                       .Build(emptyServiceProvider)
            ;

            var task = host.RunAsync();

            return(task);
        }
        public static Task RunAsync <THostedServiceProgram, TStartup>(IServiceProvider configurationServiceProvider)
            where THostedServiceProgram : class, IHostedService
            where TStartup : class, IStartup
        {
            var host = HostServiceBuilder.New()
                       .UseHostedServiceProgram <THostedServiceProgram>()
                       .UseStartup <TStartup>()
                       .Build(configurationServiceProvider)
            ;

            var task = host.RunAsync();

            return(task);
        }