I'm using Fluent(1.1.0) NHibernate(2.1.2) and I've got a (sub)subclass with a many-to-many reference to another class:
(Sub)Sub Class --< Cross Table >-- Other Class
or
FloorplanObject (base class)
Geometry (Subclass)
Stand (SubSubclass) --< ExhibitorStand >-- Exhibitor
Base Class:
public class FloorplanObject
{
public int Id { get; set; }
public string Name { get; set; }
}
Base Class Mapping:
class FloorplanObjectMap : ClassMap<FloorplanObject>
{
public FloorplanObjectMap()
{
Id(x => x.Id);
Map(x => x.Name);
}
}
Sub Class:
public class Geometry : FloorplanObject
{
public virtual List<float> Positions { get; set; }
public Geometry()
{
Positions = new List<float>();
}
}
Sub Class Mapping:
public class GeometryMap : SubclassMap<Geometry>
{
public GeometryMap()
{
Map(x => x.Positions);
}
}
(Sub) Sub Class:
public class Stand : Geometry
{
public virtual string StandNumber { get; set; }
public virtual List<Exhibitor> HasExhibitors { get; set; }
public Stand()
{
HasExhibitors = new List<Exhibitor>();
}
}
(Sub) Sub Class Mapping:
public class StandMap : SubclassMap<Stand>
{
public StandMap()
{
Map(x => x.StandNumber);
HasManyToMany(x => x.HasExhibitors)
.Cascade.All()
.Inverse()
.Table("ExhibitorStand");
}
}
Other Class:
public class Exhibitor
{
public virtual int Id { get; private set; }
public virtual string Name { get; set; }
public virtual List<Stand> OnStands { get; set; }
public Exhibitor()
{
OnStands = new List<Stand>();
}
}
Other Class Mapping:
public class ExhibitorMap : ClassMap<Exhibitor>
{
public ExhibitorMap()
{
Id(x => x.Id);
Map(x => x.Name);
HasManyToMany(x => x.OnStands)
.Cascade.All()
.Table("ExhibitorStand");
}
}
On initializing an ISession with the above mappings I get the following error:
NHibernate.MappingException: An association from the table ExhibitorStand refers to an unmapped class: Stand
Does anyone have a clue as to what I'm doing wrong here?