一、简介
ABP 的软删除是为了,在删除的时候,不是真正的删除数据,是为了保护数据。
二、具体实现
在 Core 层,我们需要这个实体去实现这个 ISoftDelete 接口。实现它的 public virtual bool IsDeleted { get; set; } 方法即可。

namespace xxx.xxx.xxxxx
{
using Abp.Domain.Entities;
/// <summary>
/// 餐馆招聘 (Mg58Infos_RestaurantRecruitment) 实体
/// </summary>
public partial class RestaurantRecruitment : BasicInfo, ISoftDelete
{
public bool IsDeleted { get; set; }
}
}

也可以实现 IFullAudited 方法,这个方法全一些。这个接口本身就继承了 ISoftDelete 接口。

namespace xx.xxx.xxx
{
using Abp.Domain.Entities.Auditing;
using xx.xx.xx;
using System;

ABP框架采用软删除机制,保护数据不被真正删除。实现方式是在实体中实现ISoftDelete接口,添加IsDeleted属性。若需要全面审计,可实现IFullAudited接口。查询已删除数据时,通过特定方法过滤IsDeleted字段。
747

被折叠的 条评论
为什么被折叠?



