mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-18 17:48:11 +08:00
-
This commit is contained in:
@@ -26,8 +26,8 @@ namespace OrmTest
|
||||
//new SelectQuery(1).Init();
|
||||
//new AutoClose(1).Init();
|
||||
//new Insert(1).Init();
|
||||
//new Delete(1).Init();
|
||||
new Update(1).Init();
|
||||
new Delete(1).Init();
|
||||
//new Update(1).Init();
|
||||
//new Mapping(1).Init();
|
||||
|
||||
/***Performance Test***/
|
||||
|
@@ -21,15 +21,33 @@ namespace OrmTest
|
||||
{
|
||||
var db = GetInstance();
|
||||
//by entity
|
||||
var s1= db.Deleteable<Student>().Where(new Student() { Id = 1 }).ToSql();
|
||||
var t1= db.Deleteable<Student>().Where(new Student() { Id = 1 }).ToSql();
|
||||
base.Check(@"DELETE FROM [Student] WHERE Id IN ('1') ",
|
||||
null,
|
||||
t1.Key,
|
||||
null, "Delte t1 error"
|
||||
);
|
||||
//use lock
|
||||
var s2 = db.Deleteable<Student>().With(SqlWith.RowLock).ToSql();
|
||||
var t2 = db.Deleteable<Student>().With(SqlWith.RowLock).ToSql();
|
||||
base.Check(@"DELETE FROM [Student] WITH(ROWLOCK) ",
|
||||
null,
|
||||
t2.Key,
|
||||
null, "Delte t2 error"
|
||||
);
|
||||
|
||||
//by primary key
|
||||
var s3 = db.Deleteable<Student>().In(1).ToSql();
|
||||
var t3 = db.Deleteable<Student>().In(1).ToSql();
|
||||
base.Check(@"DELETE FROM [Student] WHERE Id IN ('1') ",
|
||||
null,
|
||||
t3.Key,
|
||||
null, "Delte tt error"
|
||||
);
|
||||
//by primary key array
|
||||
var s4 = db.Deleteable<Student>().In(new int[] { 1,2}).ToSql();
|
||||
var t4 = db.Deleteable<Student>().In(new int[] { 1,2}).ToSql();
|
||||
base.Check(@"DELETE FROM [Student] WHERE Id IN ('1','2') ", null, t4.Key, null, "Update t4 error");
|
||||
|
||||
//by expression
|
||||
var s5 = db.Deleteable<Student>().Where(it=>it.Id==1).ToSql();
|
||||
var t5 = db.Deleteable<Student>().Where(it=>it.Id==1).ToSql();
|
||||
}
|
||||
|
||||
public SqlSugarClient GetInstance()
|
||||
|
Reference in New Issue
Block a user