Same table relationship in Entity Framework

前端 未结 2 1483
耶瑟儿~
耶瑟儿~ 2020-12-30 09:55

Is it possible to have an association mapping a table to itself?

e.g.

Table:  
ConditionId  
ConditionName 
... 
...  
ParentConditionId


        
相关标签:
2条回答
  • 2020-12-30 10:30

    Yes it is possible. Put the FK in your database and the wizard will map it correctly. Make sure ParentConditionId is nullable.

    0 讨论(0)
  • 2020-12-30 10:30

    Take a look tutorial which can be download here . It explains in detail how to model self-reference table.

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