This commit is contained in:
sunkaixuan
2017-05-08 00:33:40 +08:00
parent 4c732f25dc
commit be99b5f9c2
3 changed files with 19 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
using OrmTest.UnitTest;
using OrmTest.Models;
using OrmTest.UnitTest;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -18,7 +19,17 @@ namespace OrmTest
public void Init()
{
var db = GetInstance();
//by entity
var s1= db.Deleteable<Student>().Where(new Student() { Id = 1 }).ToSql();
//use lock
var s2 = db.Deleteable<Student>().With(SqlWith.RowLock).ToSql();
//by primary key
var s3 = db.Deleteable<Student>().Where(1).ToSql();
//by primary key array
var s4 = db.Deleteable<Student>().Where(new int[] { 1,2}).ToSql();
//by expression
var s5 = db.Deleteable<Student>().Where(it=>it.Id==1).ToSql();
}
public SqlSugarClient GetInstance()