You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a handler for a localevent implementing the interface ILocalEventHandler and registering the handler for DI, only transient and singleton work as expected, scoped lifetime does not.
Reproduction Steps
usingSystem.Threading.Tasks;usingVolo.Abp.DependencyInjection;usingVolo.Abp.EventBus;namespaceAbpDemo{publicclassMyHandler():ILocalEventHandler<StockCountChangedEvent>,IScopedDependency{publicasyncTaskHandleEventAsync(StockCountChangedEventeventData){// When multiple events occur in the same request we get a new instance of MyHandler for every event handled here}}}
Expected behavior
Expected behaviour is that the lifetime scope of the request is applied to the eventhandler.
Actual behavior
No response
Regression?
No response
Known Workarounds
No response
Version
8.2.0
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Windows (Default)
Other information
No response
The text was updated successfully, but these errors were encountered:
You state that the Handler class is not to be activated in a HTTP Request, but I would assume that the local events (Domain Events) published in the aggregateroot or entity that are processed by the ABP framework when the changes are saved to the database are executed in the same scope and not in a new scope! The local events are handled inside the UoW so I would think that they should also be in the same scope.
Is there an existing issue for this?
Description
When creating a handler for a localevent implementing the interface ILocalEventHandler and registering the handler for DI, only transient and singleton work as expected, scoped lifetime does not.
Reproduction Steps
Expected behavior
Expected behaviour is that the lifetime scope of the request is applied to the eventhandler.
Actual behavior
No response
Regression?
No response
Known Workarounds
No response
Version
8.2.0
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Windows (Default)
Other information
No response
The text was updated successfully, but these errors were encountered: