四、删除 Delete
文档目录
开始使用 初始化查询实例:
LambdaToSql.SqlClient DB = new LambdaToSql.SqlClient();
删除单个实体,通过Guid主键删除
var guid = Guid.Parse("5ed14b29-bf79-4a59-8ec4-9440f245dc10"); var entity = DB.QueryTable<EntityModel.System_UserInfo>(ex => ex.Guid == guid).FirstOrDefault(); var i = DB.DeleteTble<EntityModel.System_UserInfo>(entity).ExecuteNonQuery(); var i = DB.DeleteTble<EntityModel.System_UserInfo>(ex => ex.Guid == Guid.Parse("9c1d1247-cd2c-424d-be14-ef8abae655a4")).ExecuteNonQuery();
条件删除
var i = DB.DeleteTble<EntityModel.System_UserInfo>(ex => ex.PassWord == "1").ExecuteNonQuery(); var item = new string[] { "15842709668", "18609877687", "15804279711", "13998756128", "13019965033" }.ToList(); var i1 = DB.DeleteTble<EntityModel.System_UserInfo>(ex => item.NotContains(ex.LoginName)).ExecuteNonQuery();