LINQ 表达规则是
linqquery : fromClause queryBody
;
fromClause : FROM identifier (AS typeName)? IN expression
;
queryBody : (queryBodyClause)* selectOrGroupclause (queryContinuation)?
;
queryBodyClause : fromClause
| LET identifier ASSIGN_OP expression
| WHERE expression
| JOIN identifier (AS typeName)? IN expression ON expression EQUALS expression joinIntoClause?
| ORDERBY ordering (, ordering)*
;
joinIntoClause : INTO identifier
;
ordering : expression (ASCENDING|DESCENDING)?
;
selectOrGroupclause : SELECT expression
| GROUP expression BY expression
;
queryContinuation : INTO identifier queryBody
LINQ 查询示例
VAR oAll := FROM D IN oDev ;
JOIN C IN oC ON D:Country EQUALS C:Name ;
ORDERBY D:LastName ;
SELECT CLASS {D:Name, D:Country, C:Region}
在这个例子中,您将看到
fromclause: FROM D in oDev
querybody 1: JOIN C IN oC ON D:Country EQUALS C:Name
querybody 2: ORDERBY D:LastName
selectOrGroupClause: SELECT CLASS {...}
其他例子见 LINQ 示例