[ linq2db ] 使用LoadWith()对外键进行查询

[table]表一
Student           
{
[PrimaryKey]
  Id,
  Name,
  ClassID    外键  --   
[Association]       |
  classId           |        
}                   |
                    |
[table]表二          |
Class               |   
{                   |
[PrimaryKey]        |
 Id,         <------ 
 Name,           
[Association]
 students
}


from n in students.LoadWith(student=>student.classId)
select n;

更多例子:

https://github.com/linq2db/linq2db/blob/bf1b0f83c43ef64491cc6892445a13ba115ceac5/Tests/Linq/Linq/LoadWithTests.cs

posted @ 2017-06-26 20:33  百花园路  阅读(791)  评论(0)    收藏  举报