<bdo id='Qvmgk'></bdo><ul id='Qvmgk'></ul>
      <legend id='Qvmgk'><style id='Qvmgk'><dir id='Qvmgk'><q id='Qvmgk'></q></dir></style></legend>
    1. <tfoot id='Qvmgk'></tfoot>

      <small id='Qvmgk'></small><noframes id='Qvmgk'>

    2. <i id='Qvmgk'><tr id='Qvmgk'><dt id='Qvmgk'><q id='Qvmgk'><span id='Qvmgk'><b id='Qvmgk'><form id='Qvmgk'><ins id='Qvmgk'></ins><ul id='Qvmgk'></ul><sub id='Qvmgk'></sub></form><legend id='Qvmgk'></legend><bdo id='Qvmgk'><pre id='Qvmgk'><center id='Qvmgk'></center></pre></bdo></b><th id='Qvmgk'></th></span></q></dt></tr></i><div id='Qvmgk'><tfoot id='Qvmgk'></tfoot><dl id='Qvmgk'><fieldset id='Qvmgk'></fieldset></dl></div>
      1. json.net;序列化实体框架对象(循环引用错误)

        json.net; serialize entity framework object (circular reference error)(json.net;序列化实体框架对象(循环引用错误))
      2. <legend id='8ccYD'><style id='8ccYD'><dir id='8ccYD'><q id='8ccYD'></q></dir></style></legend>

          • <i id='8ccYD'><tr id='8ccYD'><dt id='8ccYD'><q id='8ccYD'><span id='8ccYD'><b id='8ccYD'><form id='8ccYD'><ins id='8ccYD'></ins><ul id='8ccYD'></ul><sub id='8ccYD'></sub></form><legend id='8ccYD'></legend><bdo id='8ccYD'><pre id='8ccYD'><center id='8ccYD'></center></pre></bdo></b><th id='8ccYD'></th></span></q></dt></tr></i><div id='8ccYD'><tfoot id='8ccYD'></tfoot><dl id='8ccYD'><fieldset id='8ccYD'></fieldset></dl></div>
            • <bdo id='8ccYD'></bdo><ul id='8ccYD'></ul>

                <tbody id='8ccYD'></tbody>
              <tfoot id='8ccYD'></tfoot>

                1. <small id='8ccYD'></small><noframes id='8ccYD'>

                  本文介绍了json.net;序列化实体框架对象(循环引用错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个实体框架实体,我想将其序列化为 json 对象.我环顾四周,发现 json.net (http://james.newtonking.com/projects/json-net.aspx) 应该能够使用开箱即用"的循环引用序列化对象.所以我尝试使用

                  I have an entity framework entity that i want to serialize as a json object. I looked around and found out that json.net (http://james.newtonking.com/projects/json-net.aspx) should be able to serialize objects with circular references "out of the box". So i tried using

                  string json = JsonConvert.SerializeObject(/* my ef entity */);
                  

                  但我仍然遇到同样的错误.问题可能是我需要使用 ReferenceLoopHandling.IgnoreContractResolver,但我不确定如何使用它们.任何帮助深表感谢!谢谢

                  But im still getting the same error. The problem might be that i need to use ReferenceLoopHandling.Ignore and a ContractResolver, but im not sure how to use them. Any help is much appreciated! Thanks

                  推荐答案

                  我的解决方案是简单地删除子实体上的父引用.

                  My solution was to simply remove the parent reference on my child entities.

                  所以在我的模型中,我选择了关系并将父引用更改为内部而不是公共.

                  So in my model, I selected the relationship and changed the Parent reference to be Internal rather than Public.

                  可能不是所有人的理想解决方案,但对我有用.

                  May not be an ideal solution for all, but worked for me.

                  这篇关于json.net;序列化实体框架对象(循环引用错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
                  Parameter count mismatch with Invoke?(参数计数与调用不匹配?)
                  How to store delegates in a List(如何将代表存储在列表中)
                  How delegates work (in the background)?(代表如何工作(在后台)?)
                  C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)
                  Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)
                  • <i id='N1P9n'><tr id='N1P9n'><dt id='N1P9n'><q id='N1P9n'><span id='N1P9n'><b id='N1P9n'><form id='N1P9n'><ins id='N1P9n'></ins><ul id='N1P9n'></ul><sub id='N1P9n'></sub></form><legend id='N1P9n'></legend><bdo id='N1P9n'><pre id='N1P9n'><center id='N1P9n'></center></pre></bdo></b><th id='N1P9n'></th></span></q></dt></tr></i><div id='N1P9n'><tfoot id='N1P9n'></tfoot><dl id='N1P9n'><fieldset id='N1P9n'></fieldset></dl></div>
                        <tbody id='N1P9n'></tbody>

                          <bdo id='N1P9n'></bdo><ul id='N1P9n'></ul>

                          <legend id='N1P9n'><style id='N1P9n'><dir id='N1P9n'><q id='N1P9n'></q></dir></style></legend>

                          <small id='N1P9n'></small><noframes id='N1P9n'>

                        • <tfoot id='N1P9n'></tfoot>