Search code examples
c#model-view-controllerentity-framework-6json-serialization

jsonserializationexception: self referencing loop detected for property


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

when I build the project I can see this page jsonserializationexception

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


Solution

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