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?

  • 3
    can you try [@@templateid='{1AEE2D9C-1599-4B49-9DB2-FD638969963C}']. You forgot curly brackets – Vlad Iobagiu May 24 '17 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. – Dylan Young May 25 '17 at 2:41
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; }
}
| improve this answer | |
  • if it helps you, please mark it like correct answer. Maybe others have same issue. – Vlad Iobagiu Aug 16 '17 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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