I've got a set of interfaces doing inheritance as follows (trimmed for essentials):
public interface IGlassBase
public interface IMetaData : IGlassBase
public interface IBaseHubPage : IMetaData
public interface IHomePage : IBaseHubPage
Then in the mapping classes, I have the following (again trimmed for essentials):
public class GlassBaseMap : SitecoreGlassMap<IGlassBase> {
public override void Configure() {
Map(config => ... }
}
public class MetaDataMap : SitecoreGlassMap<IMetaData> {
public override void Configure() {
Map(config => { ImportMap<IGlassBase>(); }
}
public class BaseHubPageMap : SitecoreGlassMap<IBaseHubPage> {
public override void Configure() {
Map(config => { ImportMap<IMetaData>(); }
}
public class HomePageMap : SitecoreGlassMap<IHomePage> {
public override void Configure() {
Map(config => { ImportMap<BaseHubPageMap>(); }
}
And for importing the maps in the GlassMapperScCustom file, I have this:
public static void AddMaps(IConfigFactory<IGlassMap> mapsConfigFactory) {
string binPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "bin");
foreach (string dll in Directory.GetFiles(binPath, "Client*.dll", SearchOption.AllDirectories)) {
try {
Assembly loadedAssembly = Assembly.LoadFile(dll);
Type glassmapType = typeof(IGlassMap);
var maps = loadedAssembly.GetTypes().Where(x => glassmapType.IsAssignableFrom(x));
if (maps != null) {
foreach (var map in maps) {
mapsConfigFactory.Add(() => Activator.CreateInstance(map) as IGlassMap);
}
}
} catch (FileLoadException loadEx) {
} // The Assembly has already been loaded.
catch (BadImageFormatException imgEx) {
} // If exception is thrown, the file is not an assembly.
}
}
Everything works fine if I keep the HomePageMap out of the mix, but when I add it back in, I get this error: Could not find the configuration for type Client.Website.Models.Configuration.BaseHubPageMap
. Is there an inheritance limit I'm hitting to prevent this from working right, or some other import or configuration process I need to do?