Exemple #1
0
 public static IPlusApplicationWithExternalServiceProvider AddApplication(
     [NotNull] this IServiceCollection services,
     [NotNull] Type startupModuleType,
     [CanBeNull] Action <PlusApplicationCreationOptions> optionsAction = null)
 {
     return(PlusApplicationFactory.Create(startupModuleType, services, optionsAction));
 }
Exemple #2
0
 public static IPlusApplicationWithExternalServiceProvider AddApplication <TStartupModule>(
     [NotNull] this IServiceCollection services,
     [CanBeNull] Action <PlusApplicationCreationOptions> optionsAction = null)
     where TStartupModule : IPlusModule
 {
     return(PlusApplicationFactory.Create <TStartupModule>(services, optionsAction));
 }
        public Task StartAsync(CancellationToken cancellationToken)
        {
            using (var application = PlusApplicationFactory.Create <SimpleConsoleDemoModule>(options =>
            {
                options.UseAutofac();
                options.Services.AddLogging(c => c.AddSerilog());
            }))
            {
                application.Initialize();

                var helloWorldService = application.ServiceProvider.GetService <IHelloWorldService>();
                helloWorldService.HelloWorld();

                application.Shutdown();
            }

            return(Task.CompletedTask);
        }