Search code examples
c#sitecoreglass-mapper

GlassMapper SitecoreQuery Attribute (SitecoreId Instead of Path)


I am trying to return items from a specific root item as below: (Using GlassMapper)

[SitecoreQuery("/sitecore/content/Dresses/Type//*[@@templateid = '{F4294A0F-EE89-4A12-BA25-A7605F135A4A}']")]
        IEnumerable<ILookup> Type { get; set; }

I am using Resharper and it is advising me use SitecoreID instead of path, but does glassmapper going to return the SitecoreID children if i use it?

or

Does [SitecoreChildren] Attribute has an option to get chridren from specific Item, i can only see Infertype and isLazy?

or

Is there any attributes in GlassMapper which will be useful in my case?


Solution

  • What you have looks correct. I don't know why resharper is telling you what it is telling you.

    You should avoid the double slash at the end of your query. This will do a descendants search which is slow.

    For now I would ignore resharper.