Example #1
0
        private IItem resolveItem(ItemEntity entity, ItemResolving resolving)
        {
            var item = new DefaultItem(entity, context);

            if (resolving.ChildrenTypes.Any())
            {
                var children = getChildrenOfItem(item, resolving.ChildrenTypes);
                item.AddChildren(children);
            }

            return(item);
        }
Example #2
0
        public IItem GetItemByReference(IItemReference r, ItemResolving resolving)
        {
            if (r == null)
            {
                throw new ArgumentNullException(nameof(r));
            }
            if (resolving == null)
            {
                throw new ArgumentNullException(nameof(resolving));
            }
            if (r.Equals(Root))
            {
                throw new ArgumentException("Cannot get root item: " + r, "r");
            }

            var entity = provider.QuerySingleItem(r.Type.Name, r.Guid);

            if (entity == null)
            {
                return(null);
            }

            return(resolveItem(entity, resolving));
        }