How to do an implicit join in linqpad?
Hi
How do I do an implicit join in linqpad using navigation properties?
For instance, if I have the table
TeamMatchResult {
int Id;
int TeamMatchId;
virual TeamMatch TeamMatch;
}
and TeamMatchId is an FK into
TeamMatch {
int id;
int Player1;
int Player2;
}
with EF, I am able to do something like this:
db.TeamMatchResult.Where(tmr => tmr.TeamMatch.Player1 == 1).Select(tmr => tmr)
When I do something like this in LinqPad, I get a red squiggly under tmr.TeamMatch and it says that there is no member TeamMatch. Even though if i just select the TeamMatchResult table it will show a column labeled TeamMatch that is the navigation over to the TeamMatch entry pointed to by TeamMatchId.
How do I get LinqPad to do what EF does in my C# code with the implicit join?
Thanks
How do I do an implicit join in linqpad using navigation properties?
For instance, if I have the table
TeamMatchResult {
int Id;
int TeamMatchId;
virual TeamMatch TeamMatch;
}
and TeamMatchId is an FK into
TeamMatch {
int id;
int Player1;
int Player2;
}
with EF, I am able to do something like this:
db.TeamMatchResult.Where(tmr => tmr.TeamMatch.Player1 == 1).Select(tmr => tmr)
When I do something like this in LinqPad, I get a red squiggly under tmr.TeamMatch and it says that there is no member TeamMatch. Even though if i just select the TeamMatchResult table it will show a column labeled TeamMatch that is the navigation over to the TeamMatch entry pointed to by TeamMatchId.
How do I get LinqPad to do what EF does in my C# code with the implicit join?
Thanks
Comments
here is my statement that LINQPad thinks is an error.
TeamLeagueTeams.GroupJoin(TeamMatchPositionResults, t => t.Id, p => p.TeamMatchResult.HomeTeamId,
(t, p) => new { t, p, p.TeamMatchResult })
LP says that the p.TeamMatchResult is an error in that last line.
But notice that I am referring successfully to p.TeamMatchResult in the previous argument to GroupJoin.
Am I doing something wrong with GroupJoin or is this an LP bug?
Or are you defining the TeamMatch and TeamMatchResult types themselves in a LINQPad query?