/// <summary> /// Creates a <see cref="ControllerDescriptor"/> based on the conventions /// and possible attributes found for the Controller Type specified /// </summary> /// <param name="controllerType">The controller type</param> /// <returns>A controller descriptor</returns> public static ControllerDescriptor Inspect(Type controllerType) { ControllerDescriptor descriptor; if (controllerType.IsDefined(typeof(ControllerDetailsAttribute), true)) { object[] attrs = controllerType.GetCustomAttributes( typeof(ControllerDetailsAttribute), true); ControllerDetailsAttribute details = (ControllerDetailsAttribute) attrs[0]; descriptor = new ControllerDescriptor(controllerType, ObtainControllerName(details.Name, controllerType), details.Area, details.Sessionless); } else { descriptor = new ControllerDescriptor(controllerType, ObtainControllerName(null, controllerType), String.Empty, false); } return descriptor; }
/// <summary> /// Registers the controller. /// </summary> /// <param name="descriptor">The descriptor.</param> private void RegisterController(ControllerDescriptor descriptor) { if (logger.IsDebugEnabled) { logger.DebugFormat("Registering controller descriptor for Area: '{0}' Name: '{1}'", descriptor.Area, descriptor.Name); } Tree.AddController(descriptor.Area, descriptor.Name, descriptor.ControllerType); }
/// <summary> /// Checks whether we should ignore session for the specified controller. /// </summary> /// <param name="controllerDesc">The controller desc.</param> /// <returns></returns> protected virtual bool IgnoresSession(ControllerDescriptor controllerDesc) { return controllerDesc.Sessionless; }