Json and Circular Reference Exception

前端 未结 9 1598
挽巷
挽巷 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

    In the Entity Framework version 4, there is an option available: ObjectContextOptions.LazyLoadingEnabled

    Setting it to false should avoid the 'circular reference' issue. However, you will have to explicitly load the navigation properties that you want to include.

    see: http://msdn.microsoft.com/en-us/library/bb896272.aspx

提交回复
热议问题