Activities of "sserestyen"

Hi,

We encountered a scenario where an entity (with its own entity type configuration) contains a nullable reference to IdentityUser.

In the entity configuration, we specified:

.OnDelete(DeleteBehavior.SetNull)

However, when the related IdentityUser is soft deleted, the reference is not updated to null. As a result, the entity continues to reference a soft-deleted IdentityUser, effectively creating a broken reference.

We are currently using ABP.IO version 9.3.2 (commercial license).

Our expectation was that ABP’s soft delete mechanism would also honor OnDelete(DeleteBehavior.SetNull) and automatically set the foreign key to null. However, this does not seem to be happening.

Could you please confirm whether ABP.IO handles soft delete scenarios together with OnDelete(DeleteBehavior.SetNull)? If it does, could you clarify how to achieve the expected behavior?

See below code as an example:

public class Employee : FullAuditedEntity<int>
{
    public Guid? ManagerId { get; set; }

    [ForeignKey(nameof(ManagerId))]
    public IdentityUser? IdentityUser { get; set; }

    public Employee()
    {
    }
}
public sealed class EmployeeConfig : IEntityTypeConfiguration<Employee>
{
    public void Configure(EntityTypeBuilder<Employee> builder)
    {
        builder.ToTable(FfWConsts.DbTablePrefix + "Employees", FfWConsts.DbSchema);
        builder.ConfigureByConvention();

        builder.HasOne(p => p.IdentityUser).WithMany().HasForeignKey(x => x.ManagerId).OnDelete(DeleteBehavior.SetNull);
    }
}
Showing 1 to 1 of 1 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.3.0-preview. Updated on February 25, 2026, 07:12
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.