Ejemplo n.º 1
0
        public IEnumerable <HierarchyEntry> Insert(IEnumerable <IEntity> items, IEntity parent)
        {
            var parentPath = GetHierarchyEntry(parent, true).Path;
            var state      = ItemProtectionContext.ProtectionState;
            var origin     = ItemProtectionContext.Origin;
            var entries    = items.Select(x => new HierarchyEntry
            {
                CreationTime   = DateTime.Now,
                Path           = _pathBuilder.AddChild(parentPath, x.EntityName),
                Name           = x.EntityName,
                ItemId         = x.Id,
                ParentId       = parent.Id,
                CollectionName = GetCollectionName(x.GetType()),
                TemplateId     = GetTemplateId(x.GetType()).ToString(),
                Origin         = origin,
                State          = state,
            }).ToList();

            return(AddItems(entries));
        }
Ejemplo n.º 2
0
        public void Test_add_child()
        {
            var path = _pathBuilder.AddChild("/root/child1/child2", "child3");

            Assert.Equal("/root/child1/child2/child3/", path);
        }