2

I have a interface that is instantiated by Glass using a Glass sitecoreService.Cast method. The interface has a couply of properties I would like to populate using a query but this doesn't work. Using 'SitecoreChildren' attribute does work though.

Here's my interface

public partial interface IVergoeding
{
    [SitecoreQuery("./*[@@templateid='1AEE2D9C-1599-4B49-9DB2-FD638969963C']", IsRelative = true)]
    IEnumerable<IVergoedingRegel> VergoedingRegels { get; set; }
}

I checked the templateID and that is OK. Any ideas?

2
  • 3
    can you try [@@templateid='{1AEE2D9C-1599-4B49-9DB2-FD638969963C}']. You forgot curly brackets May 24, 2017 at 14:00
  • Looks like Mike Edwards post on this: glass.lu/Blog/GettingChildItems is actually wrong, since I ran some tests and it should have the curly braces. Non-curly braces fails to work in my tests. But possibly older versions of glass it worked without braces. May 25, 2017 at 2:41

1 Answer 1

2

I transformed my comment in an answer. Looks like yoo missed curly brackets on SitecoreQuery attribute. Please try bellow code:

public partial interface IVergoeding
{
    [SitecoreQuery("./*[@@templateid='{1AEE2D9C-1599-4B49-9DB2-FD638969963C}']", IsRelative = true)]
    IEnumerable<IVergoedingRegel> VergoedingRegels { get; set; }
}
1
  • if it helps you, please mark it like correct answer. Maybe others have same issue. Aug 16, 2017 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.