ADD SelectMergeAsTable

This commit is contained in:
sunkaixuan
2017-08-25 13:02:50 +08:00
parent 4f1844fa57
commit 8a91c7fb88
4 changed files with 24 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
using OrmTest.Demo;
using OrmTest.Models;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -16,6 +17,19 @@ namespace OrmTest.Demo
{
Where();
OrderBy();
SelectMerge();
}
private static void SelectMerge()
{
var db = GetInstance();
//page join
var pageJoin = db.Queryable<Student, School>((st, sc) => new object[] {
JoinType.Left,st.SchoolId==sc.Id
})
.Select((st,sc)=>new { id=st.Id,name=sc.Name})
.SelectMergeAsTable().Where(XXX=>XXX.id==1).OrderBy("name asc").ToList();// Prefix, is, not, necessary, and take the columns in select
}
private static void Where()

View File

@@ -43,7 +43,7 @@ namespace OrmTest
OrmTest.Demo.JoinSql.Init();
OrmTest.Demo.Filter.Init();
OrmTest.Demo.ComplexModel.Init();
OrmTest.Demo.CodeFirst.Init();
OrmTest.Demo.CodeFirst.Init();;
}
}
}