Inheritance and composite foreign keys - one part of the key in base class, the other part in derived class

后端 未结 3 1006
轮回少年
轮回少年 2020-12-11 01:21

I am having problems to create an Entity Framework Code-First mapping for the following sample database schema (in SQL Server):

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-11 01:35

    I think it is simpler and reduces complexity to have Table --> TableId (PK) --> other columns including FKs.

    So in your example - adding a CustomerId column to the Customers table would solve your problem.

提交回复
热议问题