I'm using fluent nhibernate, and I'm trying to map a property in my abstract base class, that can't exist on it's own, to a certain table that depends on what the derived class is.
public class UnmappedClass : Entity<Guid>
{
// This class isn't mapped to a table on its own, its mapping depends on the class that uses it
}
public abstract class BaseClass : Entity<Guid>
{
// mapping depends on derived class, not mapped to anything in base class
protected IList<UnmappedClass> myList = new List<UnmappedClass>();
public virtual IEnumerable<UnmappedClass> Stuff
{
get { return myList.ToList(); }
}
}
public class DerivedClass : BaseClass
{
// At this point, I need to map MyClass in member myList to a table specific to DerivedClass
}
I've tried the following in an override and get the error Invalid object name 'UnmappedClass'.
mapping.HasMany(Reveal.Member<DerivedClass, IEnumerable<UnmappedClass>>("myList"))
.Table("TableName")
.Access.Field()
.Cascade.AllDeleteOrphan()
.Inverse();