我正在使用.NET Framework 3.5 SP1在Visual Studio 2008 SP1中使用ADO实体框架编写数据访问库.我试图在两个实体之间创建关联,这两个实体都是从抽象类型派生的.我使用Table Per Hierarchy(TPH)表示两个实体继承层次结构,这意味着只有两个表 - 每个实体继承层次结构一个.
注意您可以使用每种类型的表(TPT)来避免此问题,但它带来了它自身的缺点.在继承持久性模型之间进行选择时,请参阅此处和此处了解更多详细信息
以下是实体模型的Designer视图的屏幕截图:
And here is a screenshot of the database schema:
When you create associations in the ADO Entity Framework Designer between derived types modeled with TPH using Visual Studio 2008 SP1 and the .NET Framework 3.5 SP1 you are likely to receive the following an "Error 3034: Two entities with different keys are mapped to the same …