mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-02 03:13:58 +08:00
-
This commit is contained in:
@@ -21,6 +21,7 @@ namespace OrmTest.Demo
|
||||
Select();
|
||||
Ado();
|
||||
Group();
|
||||
Sqlable();
|
||||
}
|
||||
|
||||
private static void Group()
|
||||
@@ -171,6 +172,18 @@ namespace OrmTest.Demo
|
||||
var s5 = db.Queryable<Student>().Select(it => new ViewModelStudent2 { Student = it, Name = it.Name }).ToList();
|
||||
}
|
||||
|
||||
private static void Sqlable()
|
||||
{
|
||||
var db = GetInstance();
|
||||
var join3 = db.Queryable("Student", "st")
|
||||
.AddJoinInfo("School", "sh", "sh.id=st.schoolid")
|
||||
.Where("st.id>@id")
|
||||
.AddParameters(new { id = 1 })
|
||||
.Select("st.*").ToList();
|
||||
//SELECT st.* FROM [Student] st Left JOIN School sh ON sh.id=st.schoolid WHERE st.id>@id
|
||||
}
|
||||
|
||||
|
||||
public static SqlSugarClient GetInstance()
|
||||
{
|
||||
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
|
||||
|
||||
Reference in New Issue
Block a user