Map derived type to the same table in EF

后端 未结 3 1270
刺人心
刺人心 2021-01-23 23:11

The following simple code example illustrates the scenario in question. I have a Person entity, which is simply mapped to the Person table in the DB. I am using the default Enti

3条回答
  •  醉梦人生
    2021-01-23 23:35

    I don't think inheritance is the right answer to this. Is it true that 'PersonDetail' is-a Person? I would choose for creating a PersonDetail class and adding a property in the partial class that points to an instance of the PersonDetail class.

    That way you can check on your client side if the PersonDetail is set by the server by just checking if the property != null.

提交回复
热议问题