Update Demo

This commit is contained in:
sunkaixuan 2017-08-11 12:59:05 +08:00
parent 57273e8239
commit 5731c3002f

View File

@ -35,6 +35,8 @@ namespace OrmTest.Demo
var sql4 = db.Queryable<Student>().Filter(key,true).ToSql(); var sql4 = db.Queryable<Student>().Filter(key,true).ToSql();
//SELECT [ID],[SchoolId],[Name],[CreateTime] FROM [STudent] WHERE WHERE id>@id //SELECT [ID],[SchoolId],[Name],[CreateTime] FROM [STudent] WHERE WHERE id>@id
var sql5 = db.Ado.GetInt("select {0}");
//select 1
} }
public static SqlSugarClient GetInstance1() public static SqlSugarClient GetInstance1()
@ -65,6 +67,16 @@ namespace OrmTest.Demo
}, },
IsJoinQuery = false IsJoinQuery = false
}); });
//Processing prior to execution of SQL
db.Ado.ProcessingEventStartingSQL = (sql, par) =>
{
if (sql.Contains("{0}"))
{
sql = string.Format(sql, "1");
}
return new KeyValuePair<string, SugarParameter[]>(sql,par);
};
return db; return db;
} }
} }