jsonserializationexception: self referencing loop detected for property

huangapple go评论65阅读模式
英文:

jsonserializationexception: self referencing loop detected for property

问题

我正在使用 C# asp.net core ef6 linq mssql VS2022 构建项目时,可以看到这个页面:
jsonserializationexception: self referencing loop detected for property

我查看了这些页面...
2
3

第二个页面的 JsonIgnore 已经生效,但我遇到了问题。

我使用 ef core power tools ef core power tools
当我更新数据库时,ef core 会自动生成模型...

所以当我进行反向工程时(即更新数据库),JsonIgnore 会被删除。

现在我正在为所有的模型创建 viewModel... 我需要创建超过30个...
你能帮助我吗...?

英文:

I'm using C# asp.net core ef6 linq mssql VS2022

when I build the project I can see this page
jsonserializationexception: self referencing loop detected for property

I checked these pages...
2
3

the 2's JsonIgnore was worked but I have problem.

I using ef core power tools ef core power tools
and ef core help me when I update the DB
ef core auto generate the Model...

So JsonIgnore is deleting when I reverse Engineering ( It meens updating DB )

now I'm making viewModel of all the model... and I need to make over 30 ...
could you help me...?

答案1

得分: 0

我成功地通过使用 AsNoTracking() 方法来解决了这个问题。

英文:

I successfully addressed it by utilizing the AsNoTracking() method.

huangapple
  • 本文由 发表于 2023年7月6日 17:00:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76627152.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定