public void AddOrUpdateRegistration(IServiceRegistration registration, object registrationName, bool remap, bool replace) { var newRepository = new ConcurrentOrderedKeyStore <object, IServiceRegistration>(); newRepository.AddOrUpdate(registrationName, registration); if (remap) { this.serviceRepository.AddOrUpdate(registration.ServiceType, newRepository, (oldValue, newValue) => newValue); } else { this.serviceRepository.AddOrUpdate(registration.ServiceType, newRepository, (oldValue, newValue) => oldValue.AddOrUpdate(registrationName, registration, replace)); } }
/// <inheritdoc /> public void AddDecorator(Type type, IServiceRegistration serviceRegistration, bool remap, bool replace) { var newRepository = new ConcurrentOrderedKeyStore <Type, IServiceRegistration> { { serviceRegistration.ImplementationType, serviceRegistration } }; if (remap) { this.repository.AddOrUpdate(type, newRepository, (oldValue, newValue) => newValue); } else { this.repository.AddOrUpdate(type, newRepository, (oldValue, newValue) => oldValue .AddOrUpdate(serviceRegistration.ImplementationType, serviceRegistration, replace)); } }