JSON.NET Error Self referencing loop detected for type

后端 未结 25 2934
我在风中等你
我在风中等你 2020-11-22 02:16

I tried to serialize POCO class that was automatically generated from Entity Data Model .edmx and when I used

JsonConvert.SerializeObject 

相关标签:
25条回答
  • 2020-11-22 02:45

    We can add these two lines into DbContext class constructor to disable Self referencing loop, like

    public TestContext()
            : base("name=TestContext")
    {
        this.Configuration.LazyLoadingEnabled = false;
        this.Configuration.ProxyCreationEnabled = false;
    }
    
    0 讨论(0)
提交回复
热议问题