Esempio n. 1
0
        /// <summary>
        /// 对接口进行排序
        /// </summary>
        /// <param name="des"></param>
        /// <returns>
        /// 排序规则
        /// 1、按接口所在模块排序(根据配置文件所设置)
        /// 2、根据接口在Controller中代码中的顺序。
        /// </returns>
        static public string Order(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription des)
        {
            if (des.ActionDescriptor != null && !String.IsNullOrWhiteSpace(des.ActionDescriptor.DisplayName))
            {
                string ctrl;
                try
                {
                    var desc = (Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor)des.ActionDescriptor;
                    ctrl = desc.ControllerTypeInfo.FullName;
                }
                catch
                {
                    ctrl = des.ActionDescriptor.DisplayName;
                }

                string key = OrderDict.Keys.Where(e => ctrl.Contains(e)).FirstOrDefault();
                string module;
                if (key != null && OrderDict.ContainsKey(key))
                {
                    module = OrderDict[key];
                }
                else
                {
                    module = "xx";
                }
                return(module + (index++).ToString());
            }
            return(des.RelativePath);
        }
 public static T GetProperty <T>(this Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription apiDescription)
 {
     throw null;
 }
 public static void SetProperty <T>(this Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription apiDescription, T value)
 {
 }
Esempio n. 4
0
 public ApiDescription(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription apiDescription)
 {
     Description = apiDescription;
 }