private ILazyChildren LoadEntryChildren(IObjectRepositoryContainer container, ObjectId commitId, string path, ChildPropertyInfo childProperty) =>
 LazyChildrenHelper.Create(childProperty, (parent, repository) =>
 {
     var childPath = string.IsNullOrEmpty(path) ? childProperty.FolderName : $"{path}/{childProperty.FolderName}";
     var commit    = repository.Lookup <Commit>(commitId);
     var entry     = commit[childPath];
     if (entry == null)
     {
         return(Enumerable.Empty <IModelObject>());
     }
     var subTree = (Tree)entry.Target;
     return(subTree.Any() ?
            LoadEntryChildren(container, commitId, childPath, subTree) :
            Enumerable.Empty <IModelObject>());
 });
Example #2
0
 IImmutableList <ChildPropertyInfo> GetChildProperties() =>
 (from p in Type.GetProperties()
  let lazyChildrenType = LazyChildrenHelper.TryGetLazyChildrenInterface(p.PropertyType)
                             where lazyChildrenType != null
                         select new ChildPropertyInfo(p, lazyChildrenType.GetGenericArguments()[0]))
 .ToImmutableList();