Im trying to combine three DB tables (SqlServer) with eachother. I’ve tried it in lambda and non-lambda form but none of the methods described in many posts on here have worked. I think this lambda is close to working, but I’m not sure what the problem is:
var searchAgents = _db.SearchAgents
.GroupJoin(_db.SiteIds, searchagents
=> searchagents.SiteId, siteIds => siteIds.Id, (sa, si)
=> new { sa, siteid = si.FirstOrDefault() })
.GroupJoin(_db.PlzKoords, group => group.sa.Plz,
plzkoords => plzkoords.Plz, (group, plzkoords)
=> new { group, plzkoord = plzkoords.FirstOrDefault() }).ToList();
It’s underlining the second GroupJoin(), saying the type arguments for the method cannot be inferred from the usage