具有判别器策略的流畅 Nhibernate 每个子类表
无论如何,是否可以使用 Fluent 来实现带有判别器的每个子类一个表策略?从我所看到的所有文档来看,鉴别器的使用实际上告诉 Fluent 使用每个类一个表而不是每个子类一个表。
Is there anyway to use fluent in order to implement the table-per-subclass with discriminator strategy? From all of the documentation I've seen, the use of a discriminator actually tells fluent to use the table-per-class rather than table-per-subclass.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有类似的问题。到目前为止,我能想到的唯一选择是将属性放在基类上并保护其设置操作。然后,任何继承基类的类都会在其构造函数中设置该属性。到目前为止我还没有找到更好的方法。
就我而言,我有一个引用基类的类,我想查询该引用中的子类类型,并在查询中对其进行过滤,但除了我刚才建议的之外,没有其他方法。
I am having a similar issue. So far the only option i have been able to think of is to put a property on the base class and have its set operation protected. Then any class that inherits the base, sets that property in its constructor. So far i have not found a better way.
in my case i have a class that references the base class and i want to query the type of subclass in that reference and filter on it in a query but found no way apart from what i just suggested.
如果每个子类有 1 个表,那么鉴别器不是表的名称...换句话说,如果每个表只有 1 个类型,则不需要指定鉴别器。
If you have 1 table for each subclass then isn't the discriminator the name of the table... In other words you don't need to specify a discriminator if there is only 1 type per table.