public static CodeRepository CreateInstance()
 {
     if (codeRepository == null)
     {
         lock (locker)
         {
             if (codeRepository == null)
             {
                 codeRepository = new CodeRepository();
             }
         }
     }
     return(codeRepository);
 }
        public async Task <List <ApiUrl> > GetApiUrlTreeList(int parentId)
        {
            var list = await context.ApiUrls.OrderBy(p => p.SortID).ToListAsync();

            List <ApiUrl> treeList = new List <ApiUrl>();

            treeList = list.Where(p => p.ParentID == parentId).ToList();
            var methodList = await CodeRepository.CreateInstance().GetCodesListAsync(ECodesTypeId.MethodType);

            foreach (var item in treeList)
            {
                item.methodName = string.Empty;
                item.children   = list.Where(p => p.ParentID == item.UrlID).ToList();
                foreach (var child in item.children)
                {
                    child.methodName = methodList.Where(p => p.Code == child.method.ToString()).FirstOrDefault()?.Text;
                }
            }
            return(treeList);
        }