Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with the WCF Datacontract serialization of circular reference in Entity Framework

I am using Entity Framework 4, having the circular reference among some of entities, but I am getting stackoverflow exception, this is the scenario when lazy loading is enabled...

Then I have made lazy loading enabled as false and include all the related entities using Include() method but still am getting the same error... Help needed....

like image 845
Manish Pandey Avatar asked Nov 19 '25 03:11

Manish Pandey


2 Answers

I came across this before - I solved it by adding the [IgnoreDataMember] attribute to the property causing the circular reference. This was usually the navigation property that referenced the parent entity.

like image 162
Dave Lawrence Avatar answered Nov 21 '25 18:11

Dave Lawrence


If you can't remove your cycles then something like WCF cyclic references should fix it

like image 34
Olav Nybø Avatar answered Nov 21 '25 18:11

Olav Nybø