/// <summary> /// 应用程序加载所有的Controller /// </summary> /// <returns></returns> public static IList <MVCController> GetAllController() { IList <MVCController> items = new List <MVCController>(); if (HttpContext.Current.Application["MVCController"] == null) { HttpContext.Current.Application["MVCAction"] = SysAction.GetAllActionByAssembly(out items); HttpContext.Current.Application["MVCController"] = items; } else { items = (IList <MVCController>)HttpContext.Current.Application["MVCController"]; } return(items); }
/// <summary> /// 应用程序加载所有的Action动作 /// </summary> /// <returns></returns> public static string GetActionParent(string controller) { string action = ""; IList <MVCAction> items = new List <MVCAction>(); IList <MVCController> controllers = new List <MVCController>(); if (HttpContext.Current.Application["MVCAction"] == null) { items = SysAction.GetAllActionByAssembly(out controllers); HttpContext.Current.Application["MVCAction"] = items; HttpContext.Current.Application["MVCController"] = controllers; } else { items = (IList <MVCAction>)HttpContext.Current.Application["MVCAction"]; } action = items.Where(a => a.ControllerName == controller && a.IsParent == true).FirstOrDefault().ActionName; return(action); }