ServiceStack.OrmLite 学习记录4:删

db.DeleteAll();

//各种删除
db.Delete(p => p.Age == 27);//
db.Delete(q => q.Where(p => p.Age == 27));// 同上
db.Delete(where: "Age = {0}".Params(27));
db.Delete(table: "Person", where: "Age = {0}".Params(27));
// sql:DELETE FROM "Person" WHERE Age = 27

//增加删除限定条件
public class Poco
{
...
public ulong RowVersion { get; set; }
}
var updatedRow = db.SingleById(rowId); // fresh version
db.DeleteById(id:updatedRow.Id, rowversion:updatedRow.RowVersion)


posted @ 2017-02-10 10:41  吾蒸笼  阅读(272)  评论(0编辑  收藏  举报