예제 #1
0
        public bool Commit(RepoTracker changes, List <string> errList = null)
        {
            var succ = _provider.Commit(changes.GetSessionData(), errList);

            changes.Complete();
            return(succ);
        }
예제 #2
0
            /// <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);
            }
예제 #3
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="session">此参数为null,表示树的变化不需要持久化</param>
 public Tree(RepoTracker session = null)
 {
     _nodes   = new Dictionary <object, TreeNode <T> >();
     _session = new TreePersistSession(session);
 }
예제 #4
0
 public TreePersistSession(RepoTracker session)
 {
     _persistSession = session;
 }