private LifetimeDescriptor ChooseLifeTime(IContainerContext containerContext, RegistrationContext registrationContext) => registrationContext.IsWireUp ? Lifetimes.Singleton : registrationContext.Lifetime ?? containerContext.ContainerConfiguration.DefaultLifetime;
public DecoratorRegistrationContext(RegistrationContext registrationContext, IServiceRegistrator serviceRegistrator) { this.registrationContext = registrationContext; this.serviceRegistrator = serviceRegistrator; }
private void PreProcessExistingInstanceIfNeeded(IContainerContext containerContext, RegistrationContext registrationContext, Type implementationType) { if (registrationContext.ExistingInstance == null) { return; } if (!registrationContext.IsLifetimeExternallyOwned && implementationType.IsDisposable()) { containerContext.RootScope.AddDisposableTracking(registrationContext.ExistingInstance); } if (registrationContext.Finalizer == null) { return; } var method = Constants.AddWithFinalizerMethod.MakeGenericMethod(implementationType); method.Invoke(containerContext.RootScope, new[] { registrationContext.ExistingInstance, registrationContext.Finalizer }); }