I have a class where I have a set of objects such as:
[SitecoreQuery("./*[@@templateid='" + MyItem.TemplateId + "']", IsRelative = true, IsLazy = false)]
public virtual IEnumerable<MyItem> MyItems { get; set; }
Now I would like to add a new object which would be mapped to a specific item ID, rather than a template. I've therefore tried adding:
[SitecoreQuery("//*[@@id='{" + MySpecificItem.RootId + "}']", IsRelative = false, IsLazy = false)]
public virtual MySpecificItem MyItem { get; set; }
However Glass Mapper seems to return a null object when I run the code. I could map the object using Sitecore.Context.Database.GetItem within the constructor, however I'd prefer to use the attributes for consistency.