单一条件查询:
var table2Object = (from t1 in db.table1
join t2 in db.table2 on t1.id equals t2.id
select t2).FirstOrDefault();
复合条件 查询:
多个主键 联合查询
var table2Object = (from t1 in db.table1
join t2 in db.table2
on new { t1.id, t1.another_id } equals new { t2.id, t2.another_id }
select t2).FirstOrDefault();
多表联合查询:
Join3个Table
var table2Object = (from t1 in db.table1
join t2 in db.table2
on new { t1.id, t1.another_id } equals new { t2.id, t2.another_id }
join t3 in db.table3
on new { t2.id, t2.another_id } equals new { t3.id, t3.another_id }
select t2).FirstOrDefault();