Base solution for your next web application
Open Closed

Soft Delete on User Entity Causes cascade delete in other tables since upgrade to dotnetcore 3.1 and abp 5.1 packages #8618


User avatar
0
jtallon created

Hi,

It seems like the behaviour of the AbpUserManager.DeleteAsync has changed.

I have tables that have a FK reference to the userIds in the AbpUser table.

Previously, when I called DeleteAsync on a user, the records in these tables were not deleted and the user record IsDeleted flag was set to true.

However, when I use the DeleteAsync method now, the solution deletes any records that were associated with that user . The record in the AbpUsers table is still marked as IsDeleted = true however (still a soft delete).

Has something changed in the behaviour in how deletes are handled by ABP ?

Thanks in advance.


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Try ChangeTracker.CascadeDeleteTiming = CascadeTiming.OnSaveChanges;

    public MyDbContext(DbContextOptions<MyDbContext> options)
    	: base(options)
    {
    	ChangeTracker.CascadeDeleteTiming = CascadeTiming.OnSaveChanges;
    }