Base solution for your next web application
Open Closed

ANZ v3.0.0: Handle Entity Events against Setting entity #4763


User avatar
0
fabiovalerio created

Hi all,

I'm trying to handle entity events against"Setting" entity, without success.

I need to be notified when a specific setting is changed per user, so I thought that using EventBus would be a good way to do that.

Isn't it?

Any solutions?

Thanks!


6 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    What have you tried?

  • User Avatar
    0
    fabiovalerio created

    <cite>aaron: </cite> What have you tried?

    I did create a class that implements IEventHandler<EntityCreatedEventData<Setting>>, IEventHandler<EntityUpdatedEventData<Setting>>

    but interface's methods are never called!

  • User Avatar
    0
    ismcagdas created
    Support Team

    @fabiovalerio have you also implemented ITransientDependency interface like below ?

    public class MyEventHandler : IEventHandler<EntityCreatedEventData<Setting>>, IEventHandler<EntityUpdatedEventData<Setting>>, ITransientDependency
    {
        .....
        .....
    }
    
  • User Avatar
    0
    fabiovalerio created

    <cite>ismcagdas: </cite> @fabiovalerio have you also implemented ITransientDependency interface like below ?

    public class MyEventHandler : IEventHandler<EntityCreatedEventData<Setting>>, IEventHandler<EntityUpdatedEventData<Setting>>, ITransientDependency
    {
       .....
       .....
    }
    

    yep! without any success ... but, honestly, I did a lot of tries ... so I'll give it a try and report back.

    Furthermore, I already have another EventHandler against a custom entity that works perfectly without ITransientDependency inheritance!

  • User Avatar
    0
    fabiovalerio created

    Hi guys... I just did a retry to @ismcagdas's suggestion... and all works like a charm!

    Maybe when I did try for the first time something was wrong in my implementation.

    Thank you @ismcagdas and @aaron too!

  • User Avatar
    0
    alper created
    Support Team

    thanks for your feedback ;)