예제 #1
0
        public HostingEngine(
            IServiceCollection appServices,
            IStartupLoader startupLoader,
            IConfiguration config,
            bool captureStartupErrors)
        {
            if (appServices == null)
            {
                throw new ArgumentNullException(nameof(appServices));
            }

            if (startupLoader == null)
            {
                throw new ArgumentNullException(nameof(startupLoader));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _config = config;
            _applicationServiceCollection = appServices;
            _startupLoader = startupLoader;
            _captureStartupErrors = captureStartupErrors;
            _applicationLifetime = new ApplicationLifetime();
            _applicationServiceCollection.AddInstance<IApplicationLifetime>(_applicationLifetime);
        }
예제 #2
0
        public WebApplication(
            IServiceCollection appServices,
            IStartupLoader startupLoader,
            WebApplicationOptions options,
            IConfiguration config)
        {
            if (appServices == null)
            {
                throw new ArgumentNullException(nameof(appServices));
            }

            if (startupLoader == null)
            {
                throw new ArgumentNullException(nameof(startupLoader));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _config = config;
            _options = options;
            _applicationServiceCollection = appServices;
            _startupLoader = startupLoader;
            _applicationLifetime = new ApplicationLifetime();
            _applicationServiceCollection.AddSingleton<IApplicationLifetime>(_applicationLifetime);
        }
예제 #3
0
 public HostingEngine(
     [NotNull] IServiceCollection appServices, 
     [NotNull] IStartupLoader startupLoader, 
     [NotNull] IConfiguration config)
 {
     _config = config;
     _applicationServiceCollection = appServices;
     _startupLoader = startupLoader;
     _applicationLifetime = new ApplicationLifetime();
 }