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. Project_2007关键

    本人今天成功用这个密钥,安装project2007. 分享给着急的小伙伴们. W2JJW-4KYDP-2YMKW-FX36H-QYVD8 版权声明:本文博客原创文章.博客,未经同意,不得转载.

  2. std::list.pop_back() 弹空了列表导致的崩溃

    core文件输出: (gdb) bt # # ) at xxxxx/sql/signal_handler.cc: # <signal handler called> # # # # # 0 ...

  3. 飞信免费邮件api,飞信界面

    大家都知道飞信是能够免费发送短信的,可是飞信又没有官方的接口,所以无法借用移动的官方接口实现短信的免费发送,可是还是有一些破解的接口能够使用的. GET方法: 提交格式 http://66.zzuob ...

  4. HDU 5012 Dice (BFS)

    事实上是非常水的一道bfs,用字符串表示每一个状态,map判重就ok了. 题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=5012 #include&l ...

  5. Codeforces 480C Riding in a Lift dp

    主题链接:点击打开链接 意甲冠军: 特定 n a b k 构造一个长度k该序列. 使得序列中 对于随意两个相邻的数 | w[i-1] - w[i] | < | w[i] - b | 且第一个数 ...

  6. mysql函数二

    四.条件推断函数 1.if(expr,v1,v2)函数:成立返回结果v1,否则结果v2 例:select id,if(grade>=60,'pass','fail') from t; 2.IFN ...

  7. NSIS:卸载加密码示例

    原文 NSIS:卸载加密码示例 最近有几个同学问我关于卸载时加密码的问题,其实很简单,懂点基础就可以根据安装加密码那篇文章http://www.flighty.cn/html/bushu/201009 ...

  8. Linux Howto

    1. Customize the Xfce menu http://wiki.xfce.org/howto/customize-menu

  9. 恢复SQLSERVER被误删除的数据

    原文:恢复SQLSERVER被误删除的数据 恢复SQLSERVER被误删除的数据 曾经想实现Log Explorer for SQL Server的功能,利用ldf里面的日志来还原误删除的数据 这里有 ...

  10. JavaScript中null和undefined的总结

    先说null,它表示一个特殊值,常用来描述“空值”.对null执行typeof运算,结果返回字符串“object”,也就是说,可以将null认为是一个特殊的对象值,含义是“非对象”(感觉怪怪的).实际 ...