private static void LoadControllerClasses() { _controllerClasses = new Dictionary <string, ControllerClass>(StringComparer.Ordinal); List <Type> controllerTypes = new List <Type>(); foreach (Assembly assembly in _registeredAssemblies) { controllerTypes.AddRange(Util.FindCompatibleTypes(assembly, typeof(Controller))); } foreach (Type type in controllerTypes) { string baseAssemblyNamespace = type.Assembly.FullName.Split(',')[0] + ".PageControllers"; if (type.FullName.IndexOf(baseAssemblyNamespace) != -1) { string url = type.FullName.Substring(baseAssemblyNamespace.Length + 1).Replace('.', '/'); ControllerClass controllerClass = new ControllerClass(type, url.ToLower()); _controllerClasses.Add(controllerClass.Name, controllerClass); } } }
internal static ControllerClass GetControllerClass(string url) { ControllerClass controllerClass = null; _controllerClasses.TryGetValue(url, out controllerClass); return(controllerClass); }
internal void Init(ControllerClass controllerClass) { if (_viewName == null) { _viewName = controllerClass.Name; } _name = controllerClass.Name; }
internal static Controller RunNoAccessAction(ControllerAction controllerAction) { WebAppContext.Response.DisableCaching(); ControllerClass controllerClass = controllerAction.ControllerClass; using (Controller controller = controllerClass.CreateController()) { controller.NoAccess(controllerAction); return(controller); } }
internal static ControllerAction GetControllerAction(string relativePath, string pathInfo) { if (string.IsNullOrEmpty(pathInfo)) { pathInfo = "Run"; } else { pathInfo = pathInfo.Substring(1); } ControllerClass controllerClass = WebAppConfig.GetControllerClass(UrlHelper.GetUrlPathWithoutExtension(relativePath).ToLower()); return(controllerClass == null ? null : new ControllerAction(controllerClass, pathInfo)); }
internal static Controller RunControllerAction(ControllerAction controllerAction) { WebAppContext.Response.DisableCaching(); ControllerClass controllerClass = controllerAction.ControllerClass; using (Controller controller = controllerClass.CreateController()) { if (controllerClass.Run(controller, controllerAction.Method)) { return(controller); } else { return(null); } } }
public ControllerAction(ControllerClass controllerClass, string method) { _controllerClass = controllerClass; _method = method; }
internal void Init(ControllerClass controllerClass) { if (_viewName == null) _viewName = controllerClass.Name; _name = controllerClass.Name; }
private static void LoadControllerClasses() { _controllerClasses = new Dictionary<string, ControllerClass>(StringComparer.Ordinal); List<Type> controllerTypes = new List<Type>(); foreach (Assembly assembly in _registeredAssemblies) { controllerTypes.AddRange(Util.FindCompatibleTypes(assembly, typeof(Controller))); } foreach (Type type in controllerTypes) { string baseAssemblyNamespace = type.Assembly.FullName.Split(',')[0] + ".PageControllers"; if (type.FullName.IndexOf(baseAssemblyNamespace) != -1) { string url = type.FullName.Substring(baseAssemblyNamespace.Length + 1).Replace('.', '/'); ControllerClass controllerClass = new ControllerClass(type, url.ToLower()); _controllerClasses.Add(controllerClass.Name, controllerClass); } } }