var people = from p in Person
where p.age < 18
select p
Переводится как:
SELECT [t0].[PersonId], [t0].[Age], [t0].[FirstName]
FROM [dbo].[Person] AS [t0]
WHERE [t0].[Age] < @p0
где @ p0 отправляется как 18
var otherPeople = from p in people
where p.firstName equals "Daniel"
select p
Переводится как:
SELECT [t0].[PersonId], [t0].[Age], [t0].[FirstName]
FROM [dbo].[Person] AS [t0]
WHERE [t0].[FirstName] = @p0
где @ p0 отправляется как "Даниэль"
var morePeople = from p1 in people
from p2 in otherPeople
where p1.PersonId == p2.PersonId
select p1;
Переводится как:
SELECT [t0].[PersonId], [t0].[Age], [t0].[FirstName]
FROM [dbo].[Person] AS [t0], [dbo].[Person] AS [t1]
WHERE ([t0].[PersonId] = [t1].[PersonId]) AND ([t0].[Age] < @p0) AND ([t1].[FirstName] = @p1)
, где @ p0 - 18, @ p1 - "Даниэль"
В случае сомнений вызовите ToString () для вашего IQueryable или передайте TextWriter свойству Log объекта DataContext.