Appearance
软删除接口
如果实体继承ISoftDelete接口,则实体中必须定义IsDelete 和 UpdateTime字段,且在查询时,会自动过滤IsDelete字段为true的数据。
注:AppService中存在 Entities 和 GetDefaultQuery() 两个实体集合(IQueryable) Entities:不带任何条件的集合 GetDefaultQuery():带软删除过滤和多租户过滤的集合,AppService查询时默认使用这个集合
查询过滤
c#
namespace JingJian.Package.Simple.Services.Implements
{
public class BasicEmployeeFunctionService : AppService<BasicEmployeeFunction>, IBasicEmployeeFunctionService
{
public BasicEmployeeFunctionService(
IRepository<BasicEmployeeFunction, Guid> repository)
: base(repository)
{
}
}
}取消查询过滤
c#
public async Task<object> TestSoftDeleteAsync()
{
return await _basicEmployeeFunctionService.GetListAsync(x => true, new QueryOptions(isSoftDeleteFilter: false));
}