コード例 #1
0
        /// <summary>
        /// Registers the specified HTTP controllers.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="controllerTypes">The controller types.</param>
        /// <returns>A container.</returns>
        public static IWindsorContainer RegisterControllers(this IWindsorContainer container, params Type[] controllerTypes)
        {
            Check.Require(container != null);
            Check.Require(controllerTypes != null);

            foreach (Type type in controllerTypes.Where(n => ControllerExtensions.IsHttpController(n)))
            {
                container.Register(
                    Component.For(type).Named(type.FullName.ToLower()).LifeStyle.Is(LifestyleType.Transient));
            }

            return(container);
        }