开发者

EF4 : horizontal splitting or complex types?

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.

EF4 : horizontal splitting or complex types?


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜