|
@ -103,13 +103,19 @@ namespace OrmTest.Demo |
|
|
public static void Join() |
|
|
public static void Join() |
|
|
{ |
|
|
{ |
|
|
var db = GetInstance(); |
|
|
var db = GetInstance(); |
|
|
//join
|
|
|
//join 2
|
|
|
var list = db.Queryable<Student, School>((st, sc) => new object[] { |
|
|
var list = db.Queryable<Student, School>((st, sc) => new object[] { |
|
|
JoinType.Left,st.SchoolId==sc.Id |
|
|
JoinType.Left,st.SchoolId==sc.Id |
|
|
}).ToList(); |
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
//join 3
|
|
|
|
|
|
var list2 = db.Queryable<Student, School,Student>((st, sc,st2) => new object[] { |
|
|
|
|
|
JoinType.Left,st.SchoolId==sc.Id, |
|
|
|
|
|
JoinType.Left,st.SchoolId==st2.Id |
|
|
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
//join return List<dynamic>
|
|
|
//join return List<dynamic>
|
|
|
var list2 = db.Queryable<Student, School>((st, sc) => new object[] { |
|
|
var list3 = db.Queryable<Student, School>((st, sc) => new object[] { |
|
|
JoinType.Left,st.SchoolId==sc.Id |
|
|
JoinType.Left,st.SchoolId==sc.Id |
|
|
}).Select<Student,School,ViewModelStudent>((st,sc)=>new ViewModelStudent { Name= st.Name,SchoolId=sc.Id }).ToList(); |
|
|
}).Select<Student,School,ViewModelStudent>((st,sc)=>new ViewModelStudent { Name= st.Name,SchoolId=sc.Id }).ToList(); |
|
|
} |
|
|
} |
|
|