Json and Circular Reference Exception

前端 未结 9 1599
挽巷
挽巷 2020-11-27 03:17

I have an object which has a circular reference to another object. Given the relationship between these objects this is the right design.

To Illustrate

9条回答
  •  抹茶落季
    2020-11-27 04:09

    I've had the same problem this week as well, and could not use anonymous types because I needed to implement an interface asking for a List. After making a diagram showing all relationships with navigability, I found out that MyType had a bidirectional relationship with MyObject which caused this circular reference, since they both saved each other.

    After deciding that MyObject did not really need to know MyType, and thereby making it a unidirectional relationship this problem was solved.

提交回复
热议问题