0

I'm working in a Sitecore project that uses Glass and code generation to create glass classes. I wanted an easy way to get a child list on every Glass class type so on IGlassBase I added

    IEnumerable<GlassBase> Children { get; set; }

and on GlassBase

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

but I am getting a runtime error saying that Children cannot be added twice. Any ideas?

Marek Musielak
  • 26,832
  • 8
  • 72
  • 80
Teeknow
  • 1,015
  • 2
  • 17
  • 39

2 Answers2

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

Ahmed Okour
  • 2,392
  • 1
  • 16
  • 31
0

You Can try like this:

[SitecoreChildren(InferType = true)]   
IEnumerable<GlassBase> Children { get; set; }
Zhaph - Ben Duguid
  • 26,785
  • 5
  • 80
  • 117