Entity Framework Core Parent Child items in the same model, children node returns null

asp.net c# entity-framework entity-framework-core

Popular Answer

The second option is the proper one, however I have a suspicion that you are not eagerly gathering the kids while loading. Do this:

var one = context.Set<TestModel>().Include(x => x.children).FirstOrDefault();

Utilizing slow loading is an additional option. Check out more at https://docs.microsoft.com/en-us/ef/core/querying/related-data.

2
2/20/2020 2:03:16 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow