- 增加 BaseEntity 物理删除方法 Delete(true);#152

- 修复 Sqlite attachs 附加数据库别名 bug;
This commit is contained in:
28810
2019-12-09 16:48:42 +08:00
parent 9bae834386
commit cc585b4cd5
4 changed files with 25 additions and 4 deletions

View File

@ -80,8 +80,17 @@ namespace FreeSql
/// <summary>
/// 删除数据
/// </summary>
/// <param name="physicalDelete">是否物理删除</param>
/// <returns></returns>
public virtual bool Delete() => this.UpdateIsDeleted(true);
public virtual bool Delete(bool physicalDelete = false)
{
if (physicalDelete == false) return this.UpdateIsDeleted(true);
if (this.Repository == null)
return Orm.Delete<TEntity>(this as TEntity).ExecuteAffrows() == 1;
//this.SetTenantId();
this.Repository.UnitOfWork = UnitOfWork.Current.Value;
return this.Repository.Delete(this as TEntity) == 1;
}
/// <summary>
/// 恢复删除的数据
/// </summary>