0

我在一个使用 Glass 和代码生成来创建 glass 类的 Sitecore 项目中工作。我想要一种简单的方法来获取每个 Glass 类类型的子列表,所以我添加了 IGlassBase

    IEnumerable<GlassBase> Children { get; set; }

在 GlassBase 上

    [SitecoreChildren]
    public virtual IEnumerable<GlassBase> Children { get; set; }

但我收到一个运行时错误,说不能添加两次儿童。有任何想法吗?

4

2 回答 2

0

Try to add "SitecoreChildren" to your interface rather than your concrete class, like:

[SitecoreChildren]
IEnumerable<GlassBase> Children { get; set; }

This is how i have it on all of my projects, and it works fine.

hope this helps

于 2014-09-23T12:05:06.940 回答
0

你可以这样尝试:

[SitecoreChildren(InferType = true)]   
IEnumerable<GlassBase> Children { get; set; }
于 2014-12-18T14:28:58.073 回答