The Join section can write the conditions

This commit is contained in:
sunkaixuan
2017-06-19 12:16:51 +08:00
parent f0a5e4dc2b
commit a2a4bbd349
2 changed files with 14 additions and 2 deletions

View File

@@ -229,6 +229,13 @@ namespace OrmTest.Demo
.OrderBy((st, sc) => sc.Id, OrderByType.Desc)
.Select((st, sc) => new ViewModelStudent { Name = st.Name, SchoolId = sc.Id }).ToList();
//join 2
var list4_1 = db.Queryable<Student, School>((st, sc) => new object[] {
JoinType.Left,st.SchoolId==sc.Id&& st.Name == "jack"
}).ToList();
//The simple use of Join 2 table
var list5 = db.Queryable<Student, School>((st, sc) => st.SchoolId == sc.Id).Select((st,sc)=>new {st.Name,st.Id,schoolName=sc.Name}).ToList();