EF4:水平分割还是复杂类型?
我需要您的帮助来实现水平表拆分,但不适用于继承的类。我只需要将一些属性“移动”到新实体,将它们分开。这个新实体应该有一个关联 (1 <-> 1..0)
但我发现了“...它们的主键可能会发生冲突”错误。秘密在哪里? (好吧,我现在知道了:秘密是“只有 1<->1”)
但是仍然有一个悬而未决的问题:什么使用水平类或派生实体?
我有表记录(带有 PK RecordID),其中有几个带有“重复信息”的属性,这意味着该信息也可以通过使用/加入其他引用表(比如说字典)来“访问”,并且只是其中的“备份”信息。
引用的信息可能与“备份/重复”不同,这在我的域模型中有意义,所以一般来说我需要两者,但大多数选择和更新语句不涉及那些“重复属性”,所以我想以某种方式支持这一事实在概念模型中。这是正常的愿望还是获得“过度设计”模型的直接方法?
好的。这就是计划。左边是我拥有的,右边是我想要拥有的。
I need your help to implement horizontal table splitting but not for inherited class(es). I need just to "move" some attributes to new entity, separate them. This new entity should have an association (1 <-> 1..0)
But I catch the "...Their primary keys may collide" error. Where is the secret? (OK, I know it now: The secret is "only 1<->1")
But there is still one open question: what to use horizontal classes or derived entities?
I have table Records (with PK RecordID) where there are several attributes with "duplicated information" that means this information can be "accessed" also by using/joining other referenced table (let say Dictionary) and is just "backuped" information from it.
Referred information could differ from "backuped/duplicated" and this have sense in my domain model, so in general I need both, but most of select and update statements do not involve those "duplicated attributes", so I want to support this fact somehow in the conceptual model. Is this the normal desire or the direct way to get "overdesigned" model ?
OK. This is the scheme. On the left what I have, on the right what I want to have.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我找到了错误的原因。
我尝试将关联与多重性 1<->1..0 结合使用。这不适用于“水平表分割”。只有 1<->1 有效!
但我仍然没有决定 - 什么更好:将“重复字段”移动到单独的实体(过度设计?)或只是为它们创建复杂类型。
OK I found the reason for the error.
I've tried to use assocaition with multiplicity 1<->1..0 . This not works with "horizontal table splitting". Only 1<->1 work!
But I still do not decide - what is better: move "duplicated fields" to separate entyty (overdesign?) or just create complex type for them.