开发者

How to disable subclassing for a specific abstract base class using Fluent NHibernate auto mapping

I have an abstract base class that I'm referencing from one of my entities. This cau开发者_开发问答sed the following exception when generating the schema:

An association from the table Audits refers to an unmapped class: Entity

Therefore, I had to include that base class in the auto persistence model:

autoPersistenceModel.IncludeBase<Entity>()

Now, my current problem is that Fluent NHibernate creates a huge mapping for the base class, providing a joined-subclass for each entity. This is of course not what I want.

So, the question is: how do I setup the auto mapping override of in such a way that it doesn't perform any subclassing?

The AutoMapping<Entity> type only seems to provide means of choosing a subclassing strategy but no way of disabling it.


After giving this some thought, I realized that I could define a custom mapping, as simple as this:

public class EntityMap : ClassMap<Entity>
{
    public EntityMap()
    {
        Id(n => n.Id);
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜