/// <inheritdoc /> public virtual void AddRegistration(IComponentRegistration registration, bool preserveDefaults, bool originatedFromDynamicSource = false) { foreach (var service in registration.Services) { var info = GetServiceInfo(service); // We are in an ephemeral initialization; use the ephemeral set. if (_ephemeralServiceInfo is object) { info = GetEphemeralServiceInfo(_ephemeralServiceInfo, service, info); } info.AddImplementation(registration, preserveDefaults, originatedFromDynamicSource); } if (_ephemeralServiceInfo is null) { // Only when we are keeping the populated service information will we store registrations and // build pipelines for them. // The Registrations collection is only available to consumers once the tracker is contained with a ContainerRegistry // and the Complete method has been called. _registrations.Add(registration); var handler = Registered; handler?.Invoke(this, registration); if (originatedFromDynamicSource) { registration.BuildResolvePipeline(this); } } }
/// <inheritdoc /> public virtual void AddRegistration(IComponentRegistration registration, bool preserveDefaults, bool originatedFromDynamicSource = false) { foreach (var service in registration.Services) { var info = GetServiceInfo(service); info.AddImplementation(registration, preserveDefaults, originatedFromDynamicSource); } _registrations.Add(registration); var handler = Registered; handler?.Invoke(this, registration); if (originatedFromDynamicSource) { registration.BuildResolvePipeline(this); } }