I am using GlassMapper V3 and Sitecore 7.2. with MVC.
Sitecore item data is mapped automatically through the GlappMapper pipeline and the model is not very complex. The model has been extended by a partial class to also have the child items mapped automatically:
[SitecoreQuery("./*[@@templatename='Slider Element']", IsRelative = true)]
public virtual IEnumerable<Slider_Element> SliderElements { get;set; }
That works fine so far. But:
If one or more child items do not have a version in the current context language I would like to receive anyway. This works automatically for PageEditMode but not for the normal mode. But any kind of language fallback is not useful because this functinality should only be available for specific properties. What I would need is something like this:
[SitecoreQuery("./*[@@templatename='Slider Element']", IsRelative = true, GetItemsHavingNoVersions = true)]
public virtual IEnumerable<Slider_Element> SliderElements { get;set; }
As I know, GlassMapper is customizable at serveral points but did not find anything so far where I can add such functionality.
I also spent several hours searching the web and discovering the GlassMapper sourcecode.
There is a method in the SitecoreService class that seems to do parts of the logic but I am not 100% sure:
public IEnumerable<T> Query<T>(string query, bool isLazy = false, bool inferType = false) where T : class
{
return CreateTypes( typeof(T), () => { return Database.SelectItems(query); }, isLazy, inferType) as IEnumerable<T>;
}
Thank you very much in advance for your help!
best regards, Thomas