mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 23:13:42 +08:00
-
This commit is contained in:
parent
dffb0ec764
commit
c1266e7263
@ -21,6 +21,7 @@ namespace OrmTest.Demo
|
|||||||
Select();
|
Select();
|
||||||
Ado();
|
Ado();
|
||||||
Group();
|
Group();
|
||||||
|
Sqlable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Group()
|
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();
|
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()
|
public static SqlSugarClient GetInstance()
|
||||||
{
|
{
|
||||||
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
|
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
|
||||||
|
@ -82,11 +82,11 @@ namespace OrmTest.UnitTest
|
|||||||
|
|
||||||
SELECT N'1' AS Id,N'0' AS SchoolId,N'jack' AS Name,'2017-05-21 09:56:12.610' AS CreateTime,N'0' AS TestId
|
SELECT N'1' AS Id,N'0' AS SchoolId,N'jack' AS Name,'2017-05-21 09:56:12.610' AS CreateTime,N'0' AS TestId
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT N'2' AS Id,N'0' AS SchoolId,N'sun' AS Name,'1900-01-01 12:00:00.000' AS CreateTime,N'0' AS TestId
|
SELECT N'2' AS Id,N'0' AS SchoolId,N'sun' AS Name,NULL AS CreateTime,N'0' AS TestId
|
||||||
|
|
||||||
|
|
||||||
) T ON S.[Id]=T.[Id]
|
) T ON S.[Id]=T.[Id]
|
||||||
GO ", null, t7.Key, null,"Update t7 error");
|
; ", null, t7.Key, null,"Update t7 error");
|
||||||
|
|
||||||
//Re Set Value
|
//Re Set Value
|
||||||
var t8 = db.Updateable(updateObj)
|
var t8 = db.Updateable(updateObj)
|
||||||
|
@ -55,7 +55,7 @@ namespace SqlSugar
|
|||||||
{0}
|
{0}
|
||||||
|
|
||||||
) T ON {1}
|
) T ON {1}
|
||||||
GO ";
|
; ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user