示例#1
0
 private ActionDescription CreatePageActionDescription(ControllerDescription controller, MethodInfo m)
 {
     return(new ActionDescription(m)
     {
         PageController = controller
     });
 }
        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);
        }