I have the following model
using System.Collections.Generic;
namespace Ignition.Foundation.Core.Models.BaseModels
{
public interface INeedsChildren : IModelBase
{
IEnumerable<IModelBase> BaseChildren { get; set; }
}
}
public interface IPage : IMetadata, INavigation, ITaxonomy, INeedsChildren, IModelBaseWithMetadata, INeedsParent { }
public interface IIgnitionPage : IPage { }
Using AttributeMapping, the BaseChildren had the [SitecoreChildren] attribute.
I have an IPage
model that implemented INeedsChildren
, and that was in turn implemented by IIgnitionPage
.
When using Attribute mapping, this worked as expected, and when I got a page reference I had the children.
Using Fluent mapping, I have the following mappers:
using Glass.Mapper.Sc.Maps;
using Ignition.Foundation.Core.Contracts;
using Ignition.Foundation.Core.Models.BaseModels;
namespace Ignition.Foundation.Core.Installers.Mappers
{
public class NeedsChildrenMap : SitecoreGlassMap<INeedsChildren>, IGlassSettingsConsumer
{
public override void Configure()
{
Map(x =>
{
x.AutoMap().Cachable();
ImportMap<IModelBase>();
x.TemplateId(SettingsFactory.GetSitecoreSetting("Ignition.Map.Id.ModelBase"));
x.Children(a => a.BaseChildren).InferType();
});
}
public ISitecoreSettingsFactory SettingsFactory { get; set; }
}
}
And the IgnitionPageMapper
public class IgnitionPageMapper : SitecoreGlassMap<IIgnitionPage>, IGlassSettingsConsumer
{
public override void Configure()
{
Map(x =>
{
ImportMap<IPage>();
x.AutoMap().Cachable();
x.TemplateId(SettingsFactory.GetSitecoreSetting("Ignition.Feature.Core.Map.Id.IgnitionPage"));
});
}
public ISitecoreSettingsFactory SettingsFactory { get; set; }
}
And the Page Mapper
public class PageMapper : SitecoreGlassMap<IPage>, IGlassSettingsConsumer
{
public override void Configure()
{
Map(x =>
{
ImportMap<IMetadata>();
ImportMap<INavigation>();
ImportMap<ITaxonomy>();
ImportMap<INeedsChildren>();
ImportMap<INeedsParent>();
ImportMap<IModelBaseWithMetadata>();
x.AutoMap().Cachable();
x.TemplateId(SettingsFactory.GetSitecoreSetting("Ignition.Map.Id.Page"));
});
}
public ISitecoreSettingsFactory SettingsFactory { get; set; }
}
Once I use Fluent mapping, I no longer get BaseChildren of my items. I DO get Parent however, and it is wired up the same way. Am I missing something here, or is this a bug in Glass?