Fluent NHibernate Subclassmap repeats parent foreign keys
I'm fairly new to Fluent NHibernate and am trying to use inheritance but I'm getting unexpected results in the database schema created by NHibernate. Hopefully someone can shed some light or point out what I'm doing wrong this this example:
public class BaseClassMap: ClassMap<BaseCla开发者_开发技巧ss>
{
BaseClassMap()
{
Id(x => x.Id).GeneratedBy.Identity();
some other fields mapped here
References(x => x.RelatedEntity).Not.Nullable();
}
}
public class ChildClass: BaseClass
{
}
public class ChildClassMap: Subclassmap<ChildClass>
{
ChildClassMap()
{
Map some more fields here
}
}
The problem is the foreign key to the related entity is in both the child and parent tables and I can't think of any reason why I would want that. Any assistance would be greatly appreciated.
=============== * 1 ==================== 1 1 ====================
|RelatedEntity|-------- |BaseClass |-----------| ChildClass |
=============== ==================== ====================
| Id | | Id |
| RelatedEntity_id | | RelatedEntity_id |
-------------------- --------------------
精彩评论