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的更多相关文章

  1. c# json 序列化时遇到错误 error Self referencing loop detected for type

    参考网址:http://blog.csdn.net/adenfeng/article/details/41622255 在写redis缓存帮助类的时候遇到的这个问题,本来打算先序列化一个实体为json ...

  2. JSON.NET的Self referencing loop detected with type的原因以及解决办法

    模型中有循环引用是很常见的.例如,以下模型显示双向导航属性: : public class Category : { : public Category() : { : Products = new ...

  3. .NET JSON 转换 Error ” Self referencing loop detected for type“

    在进行实体转换为Json格式报错如下图: Self referencing loop detected for property 'md_agent' with type 'System.Data.E ...

  4. EF关于报错Self referencing loop detected with type的原因以及解决办法

    1)具体报错 { "Message": "出现错误.", "ExceptionMessage": "“ObjectContent` ...

  5. Newtonsoft.Json转换强类型DataTable错误:Self referencing loop detected with type ......

    问题,在使用Newtonsoft.Json对强类型的DataTable进行系列化时会出现循环引用错误 解决办法,不要直接系列化强类型的DataTable,改为 JsonConvert.Serializ ...

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

  7. codefirst mvc Self referencing loop detected for property

    登录时,json序列化用户类时提示错误"Self referencing loop detected for property--",经过5个小时的查找,发现原因可能是,用户类包含 ...

  8. Self referencing loop detected for property 错误

    EF 序列化返回json时 报错:Self referencing loop detected for property 解决方案:在webapiconfig.cs文件中,增加设置: 1.config ...

  9. Json Self referencing loop detected

    Self referencing loop detected......的错误 解决方案: 1 增加  [JsonIgnore]  过滤关联,使其不参与序列化. 这个方法简单粗暴.但是你就没办法获取关 ...

随机推荐

  1. cocos2d-x 3.1.1 学习笔记[21]cocos2d-x 创建过程

    文章出自于  http://blog.csdn.net/zhouyunxuan RootViewController.h #import <UIKit/UIKit.h> @interfac ...

  2. ssh远程登录报错REMOTE HOST IDENTIFICATION HAS CHANGED!解决方式及原因

    注意,文档中的ip和指纹已经替换为了ip.ip.ip.ip 和aa:... ,以免引起不必要的误会. icode@test:~/lab/dir/sadf$ ssh remote_name@ip.ip. ...

  3. javascript变量,作用域和内存问题(一)

          js对象的引用是很有意思的,引用型对象是不可以直接引用的,我猜测这是原型的来源之一,有大神请详解或斧正.    “引用类型的值是保存在内存中的对象.与其他语言不同,JavaScript不允 ...

  4. or1200下Raw-OS学习(例子篇)

    没有图我说个~毛(J)线(B)~对吧??? 直接上一个以前做过的项目来说说怎么去从一个前后台的程序过度到利用操作系统去管理的你代码吧~以前想过直接用事件驱动的框架去编写代码的,无奈这方面的资料实在太少 ...

  5. div+js 弹出层

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <t ...

  6. Linux以下银行乱码

    更改 /etc/sysconfig/i18n 档,例如 LANG="en_US.UTF-8",xwindow它会显示英文界面. LANG="zh_CN.GB18030&q ...

  7. hdu4570Multi-bit Trie (间隙DP)

    Problem Description IP lookup is one of the key functions of routers for packets forwarding and clas ...

  8. atitit.无线上网卡 无法搜索WiFi 解决无线路由器信号不能被连接

    atitit.无线上网卡 无法搜索WiFi 解决无线路由器信号不能被连接 #---现象 pc机无线网卡无法搜索到无线路由器的信号.. 但是,笔记本电脑和手机能够... 只要pc机无线网卡可以搜索信号, ...

  9. 编写爬虫程序的神器 - Groovy + Jsoup + Sublime(转)

    写过很多个爬虫小程序了,之前几次主要用C# + Html Agility Pack来完成工作.由于.NET FCL只提供了"底层"的HttpWebRequest和"中层& ...

  10. “采用VS2010至MFC4.2发育”最后溶液

    我层2010年这方面的研究进行了简单(http://blog.csdn.net/boweirrking/article/details/5477062),那时候没有深入思考过这当中的原理,最终给出的方 ...