Still pretty new to entity framework. So forgive me if this is a noob question. Hoping someone can shed some light on this.
I am trying to select data from 3 related tables.
Leagues -> Teams -> Rosters ->
The relationships are League.LeagueID => Team.LeagueID => Roster.TeamID
In the Roster table there is a PlayerID column
I need a query that can select all leagues where Roster has PlayerID = 1
I cannot seem to filter results on the grandchild record no matter what I try. Not finding too much on the internet either.
I have found a way to do this with anonymous types but those are read only so i can make changes to the data. I must be able to update the data after it returns.
The SQL generated should get you what you want, even it looks unreadable 😉
If you want to specifically use inner joins to do this, you can do so with code like this:
UPDATE
To do with with eager loading the child associations use
Include():