- 增加 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

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