Changing Inherited Types in Entity Framework

后端 未结 1 1233
时光说笑
时光说笑 2020-12-04 01:52

I see there is a similar question asked here but I don\'t think it was very clear so I\'m creating another : Entity Framework: Inheritance, change object type

I have

相关标签:
1条回答
  • 2020-12-04 02:33

    No. The EF inheritance does not support this scenario. The best way to create a Student for an existing Person is to use a stored procedure.
    Please note that this is not a stored procedure that is wired up to the Student entity through mappings, but a separate one that can be called explicitly from code. Ideally it would be a SP that takes a PersonID as a parameter, inserts a new row into the Student table using that PersonID, and then returns a complete Student so that it can be used immidiately.

    0 讨论(0)
提交回复
热议问题