public static TService UseStartupAndBuild <TService, TStartup>(this IServiceBuilder <TService> serviceBuilder)
            where TStartup : class, IStartup
        {
            var service = serviceBuilder.UseStartupAndBuild <TService, TStartup>(ServiceProviderHelper.GetNewEmptyServiceProvider());

            return(service);
        }
Ejemplo n.º 2
0
        public static void Run <TProgramAsService, TStartup>()
            where TProgramAsService : ProgramAsServiceBase
            where TStartup : class, IStartup
        {
            var configurationServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

            ProgramAsService.Run <TProgramAsService, TStartup>(configurationServiceProvider);
        }
Ejemplo n.º 3
0
        private static void ServiceProviderExample()
        {
            var emptyServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

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

            HostedServiceProgram.Run <THostedServiceProgram, TStartup>(configurationServiceProvider);
        }
Ejemplo n.º 5
0
        public static Task RunAsync <TAsynchronousProgramAsService, TStartup>()
            where TAsynchronousProgramAsService : AsynchronousProgramAsServiceBase
            where TStartup : class, IStartup
        {
            var configurationServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

            var task = ProgramAsService.RunAsync <TAsynchronousProgramAsService, TStartup>(configurationServiceProvider);

            return(task);
        }
Ejemplo n.º 6
0
        private static void HostExample()
        {
            var emptyServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

            var host = HostServiceBuilder.New()
                       .UseStartup <Startup>()
                       .Build(emptyServiceProvider);

            //host.Run(); // Runs host, but without a service to order host shutdown, no joy.
        }
Ejemplo n.º 7
0
        private static void WebHostExample()
        {
            var emptyServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

            var host = WebHostServiceBuilder.New()
                       .UseWebStartup <WebStartup>()
                       .Build(emptyServiceProvider);

            host.Run();
        }
        public static Task RunAsync <THostedServiceProgram, TStartup>()
            where THostedServiceProgram : class, IHostedService
            where TStartup : class, IStartup
        {
            var configurationServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

            var task = HostedServiceProgram.RunAsync <THostedServiceProgram, TStartup>(configurationServiceProvider);

            return(task);
        }
        public TDbContext CreateDbContext(string[] args)
        {
            var emptyServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

            var serviceProvider = ServiceProviderServiceBuilder.New()
                                  .UseStartup <TDesignTimeDbContextFactoryStartup>()
                                  .Build(emptyServiceProvider);

            var dbContext = serviceProvider.GetRequiredService <TDbContext>();

            return(dbContext);
        }
        public static void Run <THostedServiceProgram>()
            where THostedServiceProgram : HostedServiceProgramBase
        {
            var emptyServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

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

            host.Run();
        }
Ejemplo n.º 11
0
        private static void HostedServiceProgramExample()
        {
            //HostedServiceProgram.Run<Program02>(args);
            //HostedServiceProgram.RunAsync<Program03>(args);

            var emptyServiceProvider = ServiceProviderHelper.GetNewEmptyServiceProvider();

            var host = HostServiceBuilder.New()
                       .UseStartup <Startup>()
                       .UseHostedServiceProgram <Program04>()
                       .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);
        }
Ejemplo n.º 13
0
        public static ServiceProvider UseStartupAndBuild <TStartup>(this ServiceProviderServiceBuilder serviceProviderServiceBuilder)
            where TStartup : class, IStartup
        {
            var serviceProvider = serviceProviderServiceBuilder.UseStartupAndBuild <TStartup>(ServiceProviderHelper.GetNewEmptyServiceProvider());

            return(serviceProvider);
        }