private ControllerDescription GetServiceController(string controller) { if (string.IsNullOrEmpty(controller)) { throw new ArgumentNullException("controller"); } ControllerDescription description = null; // 查找类型的方式:按全名来查找(包含命名空间)。 // 如果有多个类型的名称相同,必须用完整的命名空间来调用,否则不能定位Controller if (controller.IndexOf('.') > 0) { if (s_metadata.ServiceFullNameDict.TryGetValue(controller, out description) == false) { if (this.DiagnoseResult != null) { this.DiagnoseResult.ErrorMessages.Add("找不到匹配的Controller类型,请检查类型不是抽象类型:" + controller); this.DiagnoseResult.ControllerTestResult = CreateTestResultList(s_metadata.ServiceFullNameDict); } } } else { if (this.DiagnoseResult != null) { this.DiagnoseResult.ErrorMessages.Add("URL中未指定命名空间,导致类型查找失败。"); } } return(description); }
private ActionDescription CreatePageActionDescription(ControllerDescription controller, MethodInfo m) { ActionAttribute actionAttr = m.GetMyAttribute <ActionAttribute>(); if (actionAttr == null) { actionAttr = new ActionAttribute(); // 不指定就采用默认实例 } return(new ActionDescription(m, actionAttr) { PageController = controller }); }
private ActionDescription CreatePageActionDescription(ControllerDescription controller, MethodInfo m) { ActionAttribute actionAttr = m.GetMyAttribute<ActionAttribute>(); if( actionAttr == null ) actionAttr = new ActionAttribute(); // 不指定就采用默认实例 return new ActionDescription(m, actionAttr) { PageController = controller }; }