예제 #1
0
 protected override void Dispose(bool explicitDispose)
 {
     if (explicitDispose)
     {
         _dependencyScopeLazy?.Dispose();
         _outerServiceProviderHandler?.Dispose();
     }
     _dependencyScopeLazy         = null;
     _outerServiceProviderHandler = null;
     _outerDependencies           = null;
     //
     base.Dispose(explicitDispose);
 }
예제 #2
0
        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);
        }
예제 #3
0
 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);
 }