I am currently working on an Umbraco 4 to 5 migration project. I am stuck with reading the Home page childrens via REST service of an Umbraco 5 site (for navigation). I knew that the REST services can be exposed via MVC areas/routes and controller actions, and using hive to get data from Umbraco . I used to get the data from Umbraco 4 with the following code
var nodes = uQuery.GetNodesByXPath(
"//root/descendant-or-self::* [@isDoc and (@level = 2) and string(umbracoNaviHide) != '1']"
I tried with the following code to fetch the data and it is not working
var childs = RoutableRequestContext.Application.Hive.GetReader(new Uri("content://"));
using (var uow = childs.CreateReadonly<IContentStore>())
{
var childIds = uow.Repositories.GetChildRelations(FixedHiveIds.ContentRootSchema, FixedRelationTypes.DefaultRelationType)
.Select(x => x.DestinationId).ToArray();
IEnumerable<TypedEntity> children = uow.Repositories.Get<TypedEntity>(true, childIds);
}
Does anyone know how to fetch the data from Umbraco5 using hive?
instead of
FixedHiveIds.ContentRootSchema
try using the Id of the parent that you'd like to look within. If you're intending to use the root, it's: FixedHiveIds.ContentVirtualRoot