加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 获取产品episerver商务

发布时间:2020-12-15 22:29:19 所属栏目:百科 来源:网络整理
导读:按照本教程 http://world.episerver.com/documentation/commerce/get-started-with-commerce/3–creating-a-start-page/开始使用episerver商务.将url写入特定问题时,它可以正常工作. 但是说我有以下树. 目录根 – testcatalog – testlevel – 试验品1和2 在
按照本教程 http://world.episerver.com/documentation/commerce/get-started-with-commerce/3–creating-a-start-page/开始使用episerver商务.将url写入特定问题时,它可以正常工作.

但是说我有以下树.

目录根 – > testcatalog – > testlevel – >试验品1和2

在testevel上(如果查看教程有模型MyNode),我如何获得所有子“产品”,testproduct 1和2?似乎有100种方法可以做到这一点.

使用最新的episerver和episerver商业(9).

解决方法

找到了一种方法.

var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
var products = contentRepository.GetChildren<MyProduct>(Model.ContentLink);

foreach(var product in products)
{
    //Do what you want.
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读