public bool Commit(RepoTracker changes, List <string> errList = null) { var succ = _provider.Commit(changes.GetSessionData(), errList); changes.Complete(); return(succ); }
/// <summary> /// 从持久化加载树 /// </summary> /// <param name="list">树节点DTO列表</param> /// <param name="persistSession">此参数不传,表示不需要把树的变更持久化</param> public static Tree <T> Load(IEnumerable <TreeNodeDto <T> > list, RepoTracker persistSession = null) { var tree = new Tree <T>(persistSession); list.ForEach(o => { var node = new TreeNode <T>(tree, o.Data) { Link = o.Link }; tree._nodes.Add(node.Id, node); if (Equals(o.Link.ParentId, null)) { tree._rootId = node.Id; } }); return(tree); }
/// <summary> /// 构造方法 /// </summary> /// <param name="session">此参数为null,表示树的变化不需要持久化</param> public Tree(RepoTracker session = null) { _nodes = new Dictionary <object, TreeNode <T> >(); _session = new TreePersistSession(session); }
public TreePersistSession(RepoTracker session) { _persistSession = session; }