/// <summary>
        /// Registers the <see cref="Page"/> instances that are declared as public concrete types in the
        /// supplied set of <paramref name="assemblies"/>. The types will be registered as concrete transient.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="assemblies">The assemblies.</param>
        public static void RegisterPages(this Container container, IEnumerable <Assembly> assemblies)
        {
            Requires.IsNotNull(container, "container");
            Requires.IsNotNull(assemblies, "assemblies");

            var pageTypes = GetConcreteTypesThatDeriveFrom <Page>(assemblies);

            container.RegisterBatchAsConcrete(pageTypes);
        }
示例#2
0
        /// <summary>
        /// Registers the <see cref="UserControl"/> instances that are declared as public concrete transient
        /// types in the supplied set of <paramref name="assemblies"/>.
        /// The types will be registered as concrete transient.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="assemblies">The assemblies.</param>
        public static void RegisterUserControls(this Container container, IEnumerable <Assembly> assemblies)
        {
            Requires.IsNotNull(container, nameof(container));
            Requires.IsNotNull(assemblies, nameof(assemblies));

            var userControlTypes = GetConcreteTypesThatDeriveFrom <UserControl>(assemblies);

            container.RegisterBatchAsConcrete(userControlTypes);
        }
        /// <summary>
        /// Registers all concrete <see cref="IHttpHandler"/> implementations (except <see cref="Page"/> and
        /// <see cref="HttpApplication"/> implementations) that are declared as public concrete
        /// types in the supplied set of <paramref name="assemblies"/>.
        /// The types will be registered as concrete transient.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="assemblies">The assemblies.</param>
        public static void RegisterHttpHandlers(this Container container, IEnumerable <Assembly> assemblies)
        {
            Requires.IsNotNull(container, "container");
            Requires.IsNotNull(assemblies, "assemblies");

            var handlerTypes =
                from type in GetConcreteTypesThatDeriveFrom <IHttpHandler>(assemblies)
                where !typeof(Page).IsAssignableFrom(type)
                where !typeof(HttpApplication).IsAssignableFrom(type)
                select type;

            container.RegisterBatchAsConcrete(handlerTypes);
        }