如何使用 Fluent NHibernate 自动映射禁用特定抽象基类的子类化
我有一个抽象基类,我从我的实体之一引用它。这导致生成架构时出现以下异常:
表 Audits 中的关联引用未映射的类:Entity
因此,我必须在自动持久性模型中包含该基类:
autoPersistenceModel.IncludeBase<Entity>()
现在,我当前的问题是 Fluent NHibernate 为基类创建了一个巨大的映射,提供了一个joined-subclass。这当然不是我想要的。
所以,问题是:如何设置自动映射覆盖,使其不执行任何子类化?
AutoMapping
类型似乎仅提供选择子类化策略的方法,但无法禁用它。
I have an abstract base class that I'm referencing from one of my entities. This caused 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过一番思考后,我意识到我可以定义一个自定义映射,就像这样简单:
After giving this some thought, I realized that I could define a custom mapping, as simple as this: