Self referencing loop detected with type
json.net
namespace EFDAL
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
public partial class MaterielProcedures
{
public int Kid { get; set; }
public Nullable<int> OKid { get; set; }
public int Node { get; set; }
public string ProcedureType { get; set; }
public string ProcedureNeed { get; set; }
public string Author { get; set; }
public System.DateTime CreateTime { get; set; }
public Nullable<System.DateTime> StartTime { get; set; }
public Nullable<double> PlanHour { get; set; }
public Nullable<System.DateTime> EndTime { get; set; }
public Nullable<int> PercentAge { get; set; }
public string ProcedureState { get; set; }
public bool IsOut { get; set; }
public virtual bom_2d bom_2d { get; set; }
}
}
var MPtest = conn.MaterielProcedures.Where(X => X.OKid == Kid).ToList();
string str2 = JsonConvert.SerializeObject(MPtest); // 报错位置
Response.Write(str2);
Self referencing loop detected with type
'System.Data.Entity.DynamicProxies.MaterielProcedures_203DBD2B01DBAD67AF86F4C0C0B7C95197B2BF101DB5CE3063BF24A1DEB2DD69'.
Path 'bom_2d.MaterielProcedures'.
外键 哦 ,
官方解说
http://msdn.microsoft.com/zh-tw/library/cd43263e-441d-4b51-a9d0-440090c2f707
个人解决方案
[JsonIgnore]
public virtual bom_2d bom_2d { get; set; }
Self referencing loop detected with type的更多相关文章
- c# json 序列化时遇到错误 error Self referencing loop detected for type
参考网址:http://blog.csdn.net/adenfeng/article/details/41622255 在写redis缓存帮助类的时候遇到的这个问题,本来打算先序列化一个实体为json ...
- JSON.NET的Self referencing loop detected with type的原因以及解决办法
模型中有循环引用是很常见的.例如,以下模型显示双向导航属性: : public class Category : { : public Category() : { : Products = new ...
- .NET JSON 转换 Error ” Self referencing loop detected for type“
在进行实体转换为Json格式报错如下图: Self referencing loop detected for property 'md_agent' with type 'System.Data.E ...
- EF关于报错Self referencing loop detected with type的原因以及解决办法
1)具体报错 { "Message": "出现错误.", "ExceptionMessage": "“ObjectContent` ...
- Newtonsoft.Json转换强类型DataTable错误:Self referencing loop detected with type ......
问题,在使用Newtonsoft.Json对强类型的DataTable进行系列化时会出现循环引用错误 解决办法,不要直接系列化强类型的DataTable,改为 JsonConvert.Serializ ...
- Request failed with status code 500以及自引用循环Self referencing loop detected for property ‘xx‘ with type
错误Error: Request failed with status code 500 ,调试前端没问题,后端也没问题,还报错"连接超时" 在Network中找到错误Self r ...
- codefirst mvc Self referencing loop detected for property
登录时,json序列化用户类时提示错误"Self referencing loop detected for property--",经过5个小时的查找,发现原因可能是,用户类包含 ...
- Self referencing loop detected for property 错误
EF 序列化返回json时 报错:Self referencing loop detected for property 解决方案:在webapiconfig.cs文件中,增加设置: 1.config ...
- Json Self referencing loop detected
Self referencing loop detected......的错误 解决方案: 1 增加 [JsonIgnore] 过滤关联,使其不参与序列化. 这个方法简单粗暴.但是你就没办法获取关 ...
随机推荐
- Unity该插件NGUI得知(9)—— Tween并转换成世界坐标系的大小NGUI尺寸
在游戏中,还有一种比较常见的动画,这是进球后产生,分数将被显示在游戏,而快速移动,使其失去位置加入.就打算使用NGUI的Tween来制作这样的分数动画效果. 依据 Unity插件之NGUI学习(2), ...
- NET功能集
NET功能集 目录 1. ObsoleteAttribute2. 设置默认值属性: DefaultValueAttribute3. DebuggerBrowsableAttribute4. ??运算符 ...
- .net与Java的WebService互调
本文记录一下.net与Java是如何进行Web Service的互相调用的. 1.准备工作 MyEclipse 10 JDK 1.6.0_13 Visual Studio 2012 .net fram ...
- or1200下Raw-OS学习(例子篇)
没有图我说个~毛(J)线(B)~对吧??? 直接上一个以前做过的项目来说说怎么去从一个前后台的程序过度到利用操作系统去管理的你代码吧~以前想过直接用事件驱动的框架去编写代码的,无奈这方面的资料实在太少 ...
- 5次Shift会触发粘滞键的妙用(转)
1.前提 你可以在平时亲身接触状态电脑,哪怕是在电脑主人不在的时候(虽然主人不在,或者关机了,进入电脑是要密码的). 2.原理 利用电脑连续按5次Shift会触发粘滞键,它会运行c:\winows\s ...
- MKMapView移动事件地图
MKMapView移动事件地图 by 吴雪莹 -(void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated { ...
- myeclipse egit 安装失败 org.eclipse.e4.ui.css.swt.theme 0.0.0
[前言] 首先确保您可能会被安装在阅读本文之前,myeclipse egit, 见文章:http://blog.csdn.net/uikoo9/article/details/17247405 事实上 ...
- how tomcat works 札记(两)----------一个简单的servlet集装箱
app1 (看着眼前这章建议读者,看how tomcat works 札记(一个)----------一个简单的webserver http://blog.csdn.net/dlf123321/art ...
- [SignalR]一个简单的聊天室
原文:[SignalR]一个简单的聊天室 1.说明 开发环境:Microsoft Visual Studio 2010 以及需要安装NuGet. 2.添加SignalR所需要的类库以及脚本文件: 3. ...
- Cache
在选择的几点思考
Cache为缓解DB装有重要数据,下面经常使用memcached和redis要总结,促进技术的选择. 1 memcached (1) 有限支持的操作,持经常使用的set.get.delete和过期删 ...