无法在实体框架 4 的 TPH 层次结构中指定抽象类
我的 TPH 层次结构如下:
A->B->C->D
A->B->C->E
A->F->G->H
A ->F->G->I
我将 A 作为抽象,所有其他类都是具体的,具有单个鉴别器列。
这很好用,但我希望 C 和 G 也是抽象的。如果我这样做,并从映射中删除它们的鉴别器,我会收到错误 3034“具有不同键的两个实体映射到同一行”。我看不出这个说法是正确的,所以我认为它在某种程度上是一个错误。
是否可以做到以上几点?
李
I have a TPH heirachy along the lines of:
A->B->C->D
A->B->C->E
A->F->G->H
A->F->G->I
I have A as Abstract, and all the other classes are concrete with a single discriminator column.
This works fine, but I want C and G to be abstract also. If I do that, and remove their discriminators from the mapping, I get error 3034 'Two entities with different keys are mapped to the same row'. I cannot see how this statement can be correct, so I assume it's a bug in some way.
Is it possible to do the above?
Lee
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于它们是抽象的 - 因此数据库中没有实体 - 您是否尝试过撒谎并假装它们确实有鉴别器。
这应该满足映射,但由于类是抽象的,您仍然无法创建或具体化。
亚历克斯
Seeing as they are abstract - so there are no entities in the database - have you tried just lying and pretending they do have a discriminator.
This should satisfy the mapping, but since the classes are abstract you still won't be able to create or materialize.
Alex