Open Closed

Domain Event handling #9971

lweng567 created

Prerequisites Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

What is your product version? 9.3.0 What is your product type (Angular or MVC)? Angular What is product framework type (.net framework or .net core)? .net Core If issue related with ABP Framework What is ABP Framework version? Zero

Hi, I am trying to leverage event handler for EntityCreatedevent, but i noticed that i cannot use a domain manager to run the async method as it requires an await, for example, await _workflowManager.GetEntitySysInitStageAsync(individual.EntityTypeId); the await needs async Task in the HandleEvent. Can you please advise if i need to do something else to be able to run async methods from a domain manager, or this is by design


1 Answer(s)
  • 0
    zony created
    Support Team

    Hi lweng567, I think you can use IAsyncEventHandler<T>, example:

    public class TestDomainHandler : IAsyncEventHandler<EntityCreatedEventData<User>>, ITransientDependency
        private readonly EditionManager _editionManager;
        public TestDomainHandler(EditionManager editionManager)
            _editionManager = editionManager;
        public async Task HandleEventAsync(EntityCreatedEventData<User> eventData)
            var result = await _editionManager.GetAllAsync();