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爲 「丹尼爾」
如有疑問,請致電您的IQueryable的toString()方法或者給一個TextWriter到DataContext的Log屬性。
來源
2008-09-18 04:22:04
Ant