随着循环引用实体框架的WCF Datacontract序列化问题 [英] Problems with the WCF Datacontract serialization of circular reference in Entity Framework

查看:199
本文介绍了随着循环引用实体框架的WCF Datacontract序列化问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用实体框架如图4所示,其中一些实体的循环引用,但我正在逐渐计算器异常,这是启用了延迟加载场景...

然后我做了延迟加载启用为假,并包括使用包括()方法中的所有相关实体,但仍然我得到了同样的错误...帮助需要.. ..


解决方案

我碰到在此之前来到

- 我通过添加[IgnoreDataMember]属性的财产造成循环引用解决它。这通常是引用的父实体的导航属性。

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....

解决方案

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.

这篇关于随着循环引用实体框架的WCF Datacontract序列化问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆