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

后端 未结 3 1010
轮回少年
轮回少年 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:31

    Well, I can't seem to comment on anything so I'm adding this as an answer.

    I created an Issue on CodePlex for this problem so hopefully they will look into it soon. Stay tuned!

    http://entityframework.codeplex.com/workitem/865


    Result of the Issue at CodePlex (which has been closed in the meantime) is that the scenario in the question is not supported and there are currently no plans to support it in the near future.

    Quote from the Entity Framework team at CodePlex:

    This is part of a more fundamental limitation where EF doesn't support having a property defined in a base type and then using it as a foreign key in a derived type. Unfortunately this is a limitation that would be very hard to remove from our code base. Given that we haven't seen a lot of requests for it, it's not something we are planning to address at this stage so we are closing this issue.

提交回复
热议问题