<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;序列化实体框架对象(循环引用错误)

        时间:2023-05-22
      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;序列化实体框架对象(循环引用错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:JSON.NET 中基于属性的类型解析 下一篇:使用 JSON.NET 序列化对象时如何添加自定义根节点?

                  相关文章

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

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

                  1. <tfoot id='N1P9n'></tfoot>