protected override void Dispose(bool explicitDispose) { if (explicitDispose) { _dependencyScopeLazy?.Dispose(); _outerServiceProviderHandler?.Dispose(); } _dependencyScopeLazy = null; _outerServiceProviderHandler = null; _outerDependencies = null; // base.Dispose(explicitDispose); }
public DependencyScope(ArgumentUtilitiesHandle <IServiceScope> outerServiceScope, bool ownsOuterServiceScope = default) { outerServiceScope.EnsureNotNull(); // _outerScopeGetter = new DefaultOuterDependencyScopeGetter(outerScope: null).ToValueHolder(ownsValue: true); _prohibitNewInstanceRequest = false; var outerServiceProviderHandler = new ServiceProviderHandler(serviceScope: outerServiceScope, ownsServiceScope: ownsOuterServiceScope); P_CtorInitializer( exporter: new DefaultDependencyExporter(handler: outerServiceProviderHandler, ownsHandler: true), ownsDependencyExporter: true, outerServiceProvider: outerServiceProviderHandler.ServiceProvider, owner: null); }
protected DependencySupport(IServiceProvider outerServiceProvider = default, IDependencySupport outerDependencies = default) { _outerDependencies = outerDependencies; _dependencyScopeLazy = new DisposableLazy <IDependencyScope>(factory: P_DependencyScopeLazyInitializer); _outerServiceProviderHandler = outerServiceProvider is null ? null : new ServiceProviderHandler(serviceProvider: outerServiceProvider); }