- 增加 FreeSql.DbContext DbSet Remove 可根据 lambda 条件删除数据的方法;

This commit is contained in:
28810
2019-10-26 11:11:05 +08:00
parent 06fba16b4a
commit f7633e9f67
2 changed files with 20 additions and 0 deletions

View File

@ -410,6 +410,16 @@ namespace FreeSql
EnqueueToDbContext(DbContext.EntityChangeType.Delete, state);
}
}
/// <summary>
/// 根据 lambda 条件删除数据
/// </summary>
/// <param name="predicate"></param>
/// <returns></returns>
public int Remove(Expression<Func<TEntity, bool>> predicate)
{
DbContextExecCommand();
return this.OrmDelete(null).Where(predicate).ExecuteAffrows();
}
#endregion
#region AddOrUpdate