コード例 #1
0
        /// <summary>
        /// Registers services in <paramref name="services"/> as targets in the passed <paramref name="targetContainer" />
        /// </summary>
        /// <param name="services">The services to be registered.</param>
        /// <param name="targetContainer">The target container that is to receive the new registrations.</param>
        /// <exception cref="ArgumentNullException">If either <paramref name="services"/> or <paramref name="targetContainer"/>
        /// are null.</exception>
        /// <remarks>This extension method just uses the <see cref="MSDIITargetContainerExtensions.Populate(ITargetContainer, IServiceCollection)"/>
        /// method also found in this library.</remarks>
        public static void RegisterTargets(this IServiceCollection services, ITargetContainer targetContainer)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }
            if (targetContainer == null)
            {
                throw new ArgumentNullException(nameof(targetContainer));
            }

            targetContainer.Populate(services);
        }