Controller.json set Serialization.ReferenceLoopHandling

前端 未结 3 931
旧时难觅i
旧时难觅i 2020-12-06 18:53

is there a way to set Controller.Json ReferenceLoopHandling property?

It is currently causing a self referencing loop when parsing entities with navigation propertie

3条回答
  •  难免孤独
    2020-12-06 19:27

    This worked for me with .NET Core 3.0.

    services.AddMvcCore().AddNewtonsoftJson(
        options => options.SerializerSettings.ReferenceLoopHandling =
            Newtonsoft.Json.ReferenceLoopHandling.Ignore);
    

提交回复
热议问题