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

Comments

  • Hmm, maybe this is just a bug with LINQPad with GroupJoin?

    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?
  • How are you setting this up in LINQPad? Do you have a connection active, and if so, what kind of connection? (LINQ-to-SQL, Entity Framework, etc).

    Or are you defining the TeamMatch and TeamMatchResult types themselves in a LINQPad query?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!