【发布时间】:2012-05-15 02:01:43
【问题描述】:
我有一个抽象基类Contact,它有两个子类:Person 和Company。
我想要Customer、Vendor 或其他可以是Company 或Person 的类型(都共享相同的主键ContactId)。
我的问题是是否可以从Contact 继承所有这些类型?如果答案是否定的,是否还有其他选择使用 PK 中的 Contact 属性?对于这种情况,推荐的设计是什么?
请注意,我希望 Employee/Customer 等也能够成为 User。
【问题讨论】:
标签: entity-framework design-patterns inheritance entity-framework-4.1 code-first