public JobHostServiceProvider(IServiceCollection descriptors, IServiceProvider rootProvider, IServiceScopeFactory rootScopeFactory) { ArgumentNullException.ThrowIfNull(descriptors); _rootProvider = rootProvider ?? throw new ArgumentNullException(nameof(rootProvider)); _rootScopeFactory = rootScopeFactory ?? throw new ArgumentNullException(nameof(rootScopeFactory)); _container = BuildContainer(descriptors); _currentResolver = new ScopedResolver(_container); }
public WebHostServiceProvider(IServiceCollection descriptors) { if (descriptors == null) { throw new ArgumentNullException(nameof(descriptors)); } _container = new Container(_defaultContainerRules); _container.Populate(descriptors); _container.UseInstance <IServiceProvider>(this); _container.UseInstance <IServiceScopeFactory>(this); _currentResolver = new ScopedResolver(_container); }
public WebHostServiceProvider(IServiceCollection descriptors) { if (descriptors == null) { throw new ArgumentNullException(nameof(descriptors)); } // preferInterpretation will be set to true to significanly improve cold start in consumption mode // it will be set to false for premium and appservice plans to make sure throughput is not impacted // there is no throughput drop in consumption with this setting. var preferInterpretation = SystemEnvironment.Instance.IsWindowsConsumption() ? true : false; _container = new Container(_defaultContainerRules, preferInterpretation: preferInterpretation); _container.Populate(descriptors); _container.UseInstance <IServiceProvider>(this); _container.UseInstance <IServiceScopeFactory>(this); _currentResolver = new ScopedResolver(_container); }