public SiteMapItem(ParentFunc parentFunc, ChildrenFunc childrenFunc, ConverterFunc converterFunc, DB db)
 {
     _childrenDelegate  = childrenFunc;
     _parentDelegate    = parentFunc;
     _converterDelegate = converterFunc;
     _db = db;
 }
 public SiteMapItem(SiteMapItem parent)
 {
     _childrenDelegate  = parent._childrenDelegate;
     _parentDelegate    = parent._parentDelegate;
     _converterDelegate = parent._converterDelegate;
     _db = parent._db;
 }
Exemplo n.º 3
0
        private static IEnumerable <TreeNode <T> > Flatten <T>(this T node, ChildrenFunc <T> childrenFunc, ITreeNode <T> parent)
        {
            if (node == null)
            {
                return(Enumerable.Empty <TreeNode <T> >());
            }
            var treeNode = new TreeNode <T>(node, parent);

            return(treeNode.Yield().Concat(childrenFunc(node).SelectMany(child => child.Flatten(childrenFunc, treeNode))));
        }
Exemplo n.º 4
0
 public static IEnumerable <ITreeNode <T> > Flatten <T>(this T node, ChildrenFunc <T> childrenFunc, SelfFunc <T> selfFunc)
 {
     return(selfFunc(node).Flatten(childrenFunc, default, selfFunc).Select((treeNode, i) => (ITreeNode <T>)treeNode.UpdateIndex(i)));