【发布时间】:2013-02-14 13:50:23
【问题描述】:
我在 VS2010 中使用 EF5。 我有两种类型的工作样本:人员,业务 我想添加一个类似的集合
DbSet<Customer> Customers
Customers 中的对象可以是 Person 或 Business。在我的应用中,我希望能够执行以下操作:
mycontext.Customers.Add(new Person());
mycontext.Customers.Add(new Business());
我认为客户表可能看起来像
id (id of Person or Business)
discriminator
如何通过代码优先实现?
【问题讨论】:
标签: c# ef-code-first entity-framework-5