Base solution for your next web application
Open Closed

How to do hard delete ? #4317


User avatar
0
manojreddy created

Hi in abp When I delete record its soft delete by default, because it FullAuditedEntity inherits from ISoftDelete, Is it possible to implement hard deleted anyway?

One solution I thought that not to use FullAuditedEntity in the model class, but I will lose AuditedEntity<TPrimaryKey>, IFullAudited, IAudited, ICreationAudited, IHasCreationTime, IModificationAudited, IHasModificationTime, IDeletionAudited feature.

Or shall I have an abstract class similar to abstract class FullAuditedEntity<TPrimaryKey> and not inherit from, IHasDeletionTime, ISoftDelete?

Please provide your suggestions.

Thanks


3 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    hi,

    you can disable SoftDelete filter. for more info <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Data-Filters#DocSoftDelete">https://aspnetboilerplate.com/Pages/Doc ... SoftDelete</a>

    using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.SoftDelete))
    {
        ...
    
  • User Avatar
    0
    manojreddy created

    Hi,

    Following code is useful in only to retrieve the deleted records. Not to hard delete the records from the table.

    If let's say I implement hard delete using SQL in custom repository.

    But Do we have some mechanism to implement audit tables? So for example, If I want to get the information of deleted rows from the table. So If I have some audit table and I make an entry for every action like insert, update and delete in this audit table. Then I can easily get all the history of respective table.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ManojReddy,

    You can also check this answer #1262@bdddb0a5-7f84-448e-a584-a913d1424ad1 if you don't want to use raw sql for hard delete.