/// <summary> /// 从缓存中获取树节点,不存在则创建, /// </summary> /// <param name="org"></param> /// <returns></returns> private TreeNodeModel GetOrCreateCacheOrgsNode(NodeInfoFromDB org) { TreeNodeModel model; if (!_cacheOrgs.TryGetValue(org.Index, out model)) { model = TransFromNodeInfo(org); _cacheOrgs.Add(org.Index, model); } return(model); }
public TreeNodeModel TransFromNodeInfo(NodeInfoFromDB info) { if (info == null) { return(null); } return(new TreeNodeModel { Index = info.Index, Name = info.Name, ParentIndex = info.ParentIndex, Nodes = new List <TreeNodeModel>() }); }