Disable SoftDelete for AbpUserRole

自闭症网瘾萝莉.ら 提交于 2019-11-28 13:12:51

Answered in this topic: https://forum.aspnetboilerplate.com/viewtopic.php?p=6180#p6193

Data filters work on selecting data. If your entity is SoftDelete, ABP always soft-deletes it and prevents actually deleting.

You can override CancelDeletionForSoftDelete method in your DbContext and prevent cancellation conditionally.

So, like this:

protected override void CancelDeletionForSoftDelete(EntityEntry entry)
{
    if (IsSoftDeleteFilterEnabled)
    {
        base.CancelDeletionForSoftDelete(entry);
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!