Entity Framework Core Get related data without nesting

entity-framework-core

Question

Is there a way using Entity Framework Core to get nested data without having to iterate through it? like a simple SQL select with joins i would like to show all data on the same table

1
1
9/6/2019 10:58:04 AM

Accepted Answer

Sounds like you know the SQL you need to get the data you want. So I suggest you create a database view and then map your ef entity to that. As long as you are just reading ef will treat the view just like it would any other table.

1
9/6/2019 12:04:40 PM

Popular Answer

I think youre looking for .Include() and .ThenInclude() methods that allow you to load related data in a eager way.

More on that topic on the official entity framework documentation at MSDN



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