我目前正在从事Umbraco 4到5迁移项目的工作。我被困在通过Umbraco 5站点的REST服务阅读主页的孩子们(用于导航)。我知道REST服务可以通过MVC区域/路由和控制器操作公开,并使用hive从Umbraco获取数据。我以前用下面的代码从Umbraco 4获取数据
var nodes = uQuery.GetNodesByXPath(
"//root/descendant-or-self::* [@isDoc and (@level = 2) and string(umbracoNaviHide) != '1']"我尝试使用下面的代码来获取数据,但它不起作用
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);
}有没有人知道如何使用从Umbraco5中获取数据,使用hive
发布于 2012-02-15 08:26:35
而不是
FixedHiveIds.ContentRootSchema
尝试使用您想要查看的父类的Id。如果您打算使用根,它是:FixedHiveIds.ContentVirtualRoot
发布于 2012-03-09 13:15:26
试过这个吗?
RoutableRequestContext.Application.Hive.QueryContent();
RoutableRequestContext.Application.Hive.QueryMedia()https://stackoverflow.com/questions/9288481
复制相似问题