【发布时间】:2012-03-09 21:15:26
【问题描述】:
我目前正在从事 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 的数据?
【问题讨论】:
标签: asp.net-mvc rest umbraco umbraco-blog