/// <summary> /// Allows appending new registrations to existing registrations made using one of the /// <b>RegisterCollection</b> overloads. /// </summary> /// <param name="serviceType">The service type of the collection.</param> /// <param name="registration">The registration to append.</param> /// <exception cref="ArgumentNullException">Thrown when one of the supplied arguments is a null /// reference (Nothing in VB).</exception> /// <exception cref="ArgumentException">Thrown when the <paramref name="serviceType"/> is not a /// reference type, is open generic, or ambiguous.</exception> /// <exception cref="InvalidOperationException">Thrown when the container is locked.</exception> /// <exception cref="NotSupportedException">Thrown when the method is called for a registration /// that is made with one of the <b>RegisterCollection</b> overloads that accepts a dynamic collection /// (an <b>IEnumerable</b> or <b>IEnumerable<TService></b>).</exception> public void AppendTo(Type serviceType, Registration registration) { Requires.IsNotNull(serviceType, nameof(serviceType)); Requires.IsNotNull(registration, nameof(registration)); Requires.IsReferenceType(serviceType, nameof(serviceType)); Requires.IsNotAnAmbiguousType(serviceType, nameof(serviceType)); Requires.IsRegistrationForThisContainer(this.container, registration, nameof(registration)); Requires.ServiceOrItsGenericTypeDefinitionIsAssignableFromImplementation(serviceType, registration.ImplementationType, nameof(registration)); Requires.OpenGenericTypesDoNotContainUnresolvableTypeArguments(serviceType, new[] { registration }, nameof(registration)); this.container.AppendToCollectionInternal(serviceType, registration); }