In version 7 we could check if there were any children of a EntityContainer by using HasChildren property this is removed in 8 how can we tell if a entity container has any children? HasPendingChanges is also gone how do we check that in 8 ?
Not important but still curious how can we get childrens of a specific EntityContainer? i noticed the ParentId will we have to get entity containers using the DataTypeService and add logic to determind if someting is a child of someting ?
In v8 you can use the EntityService to get an IEntitySlim for the container and then check HasChildren to see if it has any.
e.g
var container = entityService.Get(containerId, UmbracoObjectTypes.DataTypeContainer);
if (container.HasChildren)
{
// actually get the children
var children = entityService.GetChildren(containerId, UmbracoObjectTypes.DataTypeContainer);
if (children.Any())
{
// do stuff
}
}
Working with EntityContainers in V8
In version 7 we could check if there were any children of a EntityContainer by using HasChildren property this is removed in 8 how can we tell if a entity container has any children? HasPendingChanges is also gone how do we check that in 8 ?
Not important but still curious how can we get childrens of a specific EntityContainer? i noticed the ParentId will we have to get entity containers using the DataTypeService and add logic to determind if someting is a child of someting ?
Hi,
In v8 you can use the EntityService to get an IEntitySlim for the container and then check HasChildren to see if it has any.
e.g
is working on a reply...