Open Closed

When user data is changed in IdentityUser, EntityChangingEventData is called multipletimes #527


User avatar
0
ErenSongur created

When I change the user's information or add a new user, it enters EntityChangingEventData's HandleEventAsync method more than once. But when we use this method in other tables, it is entered once.

The method:

public async Task HandleEventAsync(EntityChangingEventData<IdentityUser> eventData) { throw new NotImplementedException(); }

  • ABP Framework version: v3.2.0
  • UI type: Angular
  • Identity Server Seperated (Angular): yes

4 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Do you mean you only changed IdentityUser once but the event was triggered multiple times?

  • User Avatar
    0
    ErenSongur created

    Yes, exactly like that

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    ok. I will check it out.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    When you create a user, there are actually two processes

    1. Creating a user will trigger the created event. see: https://github.com/abpframework/abp/blob/01a7c4738508aa348784964e73d6c1ed4eeec314/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs#L180
    2. Add role to user will trigger updated event. see: https://github.com/abpframework/abp/blob/01a7c4738508aa348784964e73d6c1ed4eeec314/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs#L81

    So it will trigger two events. But if you only update the user, the event will only be triggered once.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11