Prevent loading Many to Many relation further than first "level"
Hello, so currently i am struggling with .NET EF loading Many to Many (later called MtM) relation infinitely, which causes program to halt due to max depth being reached. I am looking for some way of avoiding that, but only after first "level". Example:
Assuming that these objects correspond to .NET EF models, this will cause infinite loop.
test
will have test1
, that has test
and so on. What i actually want is:
I've read that ChangeTracker.LazyLoadingEnabled = false;
could help with that, but even having it set to false in my DbContext, it didnt help with the error. Only partial solution i found is to enable handling of loop references in Newtonsoft.JSON options, although it works, the issue of entities looping is still there
For any help i thank in advance1 Reply
.Select()
into a DTO