ef核心 - 如何将类映射的多个变体放到同一个表中

问题描述 投票:0回答:1

我有5个带有自己的db上下文的附属程序集。我为代码优先迁移创建了第6个程序集。我们的想法是将附属程序集添加为引用,然后为所有模型创建迁移。这种设置的怪癖是某些附属程序集具有相同的类但具有更多或更少的属性(取决于它们在各自的上下文中是否有意义)。

当我创建迁移时,我得到:Cannot use table 'dbo.TableA' for entity type 'PartialClassA' since it is being used for entity type 'ClassA' and there is no relationship between their primary keys.

我希望我想要做的事情有意义,我的问题是我们如何首先使用代码来完成这项工作?

c# ef-code-first entity-framework-core ef-core-2.1
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.