❔ Selecting child tables using EF Core
I have the following class hierarchy
Enterprise => Company => Site => Department => Container
What would be the most efficent way of selecting a container with a given ID using ef core. In my DbContext I only have a reference to the root object, Enterprise
Currently I have this mess:
8 Replies
If you only want the container, why start from enterprises?
Go directly for container.
The dbContext only has the enterprise attribute. The other tables are added implecitly
So fix that.
^
If you want direct access, add direct access.
Then you just do
That would give you all containers that match a given enterprise Id
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.