Welcome to the navigation

Occaecat dolore enim consectetur do proident, anim nulla labore consequat, in nisi id incididunt elit, ad laboris aliqua, culpa ut ipsum ex cupidatat magna mollit. Cillum lorem labore duis aute id deserunt ullamco amet, nulla ut nostrud dolore minim consequat, excepteur voluptate proident, eiusmod irure pariatur, sint in sunt laborum

Yeah, this will be replaced... But please enjoy the search!

GetChildren not returning children but GetDescendents do

I got a strange behaviour from Epi when I was building an image picker for ImageData objects. The GetChildren didn't return any children but GetDescendents did. It all worked in the development and test environments but not in production.

The thing is there may be several causes to this and in this case it was fairly simple.

The code

var folderToLoad = SiteDefinition.Current.GlobalAssetsRoot;

// worked
var loader = ServiceLocator.Current.GetInstance<IContentLoader>();
var linkImages =
    loader.GetDescendents(folderToLoad)
        .Select(x => loader.Get<ImageFile>(x))
        .Where(x => x.ParentLink.ID.Equals(folderToLoad.ID));

// didn't work
var linkImages = loader.GetChildren<ImageFile>(folderToLoad);

The difference between the environments was that in the production environment ImageFiles wasn’t automatically published. Publishing the files made the GetChildren to work again.

But then in the production environment it was only the listings in the edit gui that worked, was ever released to the anonymous context.

Please note that this portal is a BETA site , I will continuously improve all functionality and performance during the coming weeks / the author