Here's what I want to do:
Dim queryX = From m In db.Master
Where m.Field = value
Group Join d In db.Detail
On m.Id Equals d.MasterId Into Group
Where d.Field = value
In English, I want to join the master and detail tables, specifying conditions on each. But this causes the following compiler error:
"Name 'd' is either not declared or not in the current scope."
It works if I put this same condition in functional form:
Group Join d In db.Detail.Where(Function(x) x.Field = value)
but I think this is more typing, harder to understand, and introduces that irritating dummy variable. I really would prefer to use the query comprehensi开发者_开发技巧on syntax. Is there a way to accomplish this?
Are you sure you need a group join here and not just a join like this
try
Dim queryX = From m In db.Master
Where m.Field = value
Join d In db.Detail
On m.Id Equals d.MasterId
Where d.Field = value;
?
精彩评论