How to remove circular reference in Entity Framework?

前端 未结 6 1977
借酒劲吻你
借酒劲吻你 2021-01-12 07:36

The circular reference between my Customer and Order entities caused a exception during serialization. Is there any way to force EF to generate one-direction reference betwe

6条回答
  •  Happy的楠姐
    2021-01-12 08:02

    When you create an association in model designer (right click add->association) you'll get a popup windows which looks like this:

    Notice the navigation property check boxes, you can deselect them if you don't want them to be generated. To solve your circular reference problem, make sure only one or none are checked, not both.

提交回复
热议问题