Disable SoftDelete for AbpUserRole

前端 未结 1 521
夕颜
夕颜 2020-12-11 12:41

By default, the AbpUserRole and AbpRole implement ISoftDelete. Is it possible to disable it?

I tried to do this:



        
相关标签:
1条回答
  • 2020-12-11 12:46

    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);
        }
    }
    
    0 讨论(0)
提交回复
热议问题