Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Get updated properties in EntityUpdatingEventData<T> event #9507


User avatar
0
bulutyonetim created

Hi,

I need to get which properties of enitity is being update in domain updating event, I there anyway for this?

I also tired this way but no hope, userBeforeUpdate have updated values not the orginal values.

[UnitOfWork]
public void HandleEvent(EntityUpdatingEventData<AbpUserBase> eventData)
{
    using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant))
    {
        //Get all users
        IQueryable<User> allUser = _userRepository.GetAll();
        var userBeforeUpdate = allUser.FirstOrDefault(ua => ua.Id == eventData.Entity.Id  && (ua.UserName == eventData.Entity.UserName || ua.EmailAddress == eventData.Entity.EmailAddress));

        //user email is being activated
        if (userBeforeUpdate.IsEmailConfirmed != eventData.Entity.IsEmailConfirmed && userBeforeUpdate.EmailConfirmationCode != eventData.Entity.EmailConfirmationCode)
        {

        }
    }
}

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

    hi

    You cannot get the changed properties in the EntityUpdatingEventData event.

    You can trigger custom events in application services or domain services.

  • User Avatar
    0
    bulutyonetim created

    Hi, Thanks.