为AbpUserRole禁用SoftDelete [英] Disable SoftDelete for AbpUserRole
本文介绍了为AbpUserRole禁用SoftDelete的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
默认情况下,AbpUserRole
和AbpRole
实现ISoftDelete
.可以禁用它吗?
By default, the AbpUserRole
and AbpRole
implement ISoftDelete
. Is it possible to disable it?
我试图这样做:
[AbpAuthorize(AppPermissions.Pages_Administration_Roles_Delete)]
public async Task DeleteRole(EntityDto input)
{
using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.SoftDelete))
{
var role = await _roleManager.GetRoleByIdAsync(input.Id);
var users = await UserManager.GetUsersInRoleAsync(role.Name);
foreach (var user in users)
{
CheckErrors(await UserManager.RemoveFromRoleAsync(user, role.Name));
}
CheckErrors(await _roleManager.DeleteAsync(role));
}
}
尽管在当前工作单元中禁用了过滤器,但它不起作用.该实体被标记为已删除.
Although the filter is disabled in the current unit of work, it doesn't work. The entity is marked as deleted.
推荐答案
查看全文