/// <summary> /// Registers modules found in an assembly. /// </summary> /// <param name="registrar">The module registrar that will make the registrations into the container.</param> /// <param name="assemblies">The assemblies from which to register modules.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="registrar"/> is <see langword="null"/>. /// </exception> /// <returns> /// The <see cref="IModuleRegistrar"/> to allow /// additional chained module registrations. /// </returns> public static IModuleRegistrar RegisterAssemblyModules(this IModuleRegistrar registrar, params Assembly[] assemblies) { if (registrar == null) { throw new ArgumentNullException(nameof(registrar)); } return(registrar.RegisterAssemblyModules <IModule>(assemblies)); }
/// <summary> /// Registers modules found in an assembly. /// </summary> /// <param name="registrar">The module registrar that will make the registrations into the container.</param> /// <param name="assemblies">The assemblies from which to register modules.</param> /// <typeparam name="TModule">The type of the module to add.</typeparam> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="registrar"/> is <see langword="null"/>. /// </exception> /// <returns> /// The <see cref="Autofac.Core.Registration.IModuleRegistrar"/> to allow /// additional chained module registrations. /// </returns> public static IModuleRegistrar RegisterAssemblyModules <TModule>(this IModuleRegistrar registrar, params Assembly[] assemblies) where TModule : IModule { if (registrar == null) { throw new ArgumentNullException("registrar"); } return(registrar.RegisterAssemblyModules(typeof(TModule), assemblies)); }