private static ILifetime ResolveLifetime(ServiceDescriptor serviceDescriptor, Scope rootScope) { if (serviceDescriptor.ImplementationInstance != null) { return(null); } ILifetime lifetime = null; switch (serviceDescriptor.Lifetime) { case ServiceLifetime.Scoped: lifetime = new PerScopeLifetime(); break; case ServiceLifetime.Singleton: lifetime = new PerRootScopeLifetime(rootScope); break; case ServiceLifetime.Transient: lifetime = new PerRequestLifeTime(); break; } return(lifetime); }
private static ILifetime ResolveLifetime(ServiceDescriptor serviceDescriptor, Scope rootScope) { ILifetime lifetime = null; switch (serviceDescriptor.Lifetime) { case ServiceLifetime.Scoped: lifetime = new PerScopeLifetime(); break; case ServiceLifetime.Singleton: lifetime = new PerRootScopeLifetime(rootScope); break; case ServiceLifetime.Transient: lifetime = NeedsTracking(serviceDescriptor) ? new PerRequestLifeTime() : null; break; } return(lifetime); }