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
Im trying to handle one DomainEvent with multiple DomainNotificationHandler that doing different task. One for emitting event for subscribe module, and one for sending automated email. Based on the current implementation of "DomainEventsDispatcher.cs" file (code below). The autofac only resolving one of my DomainNotification. I can do workaround like triggering ICommandScheduler, but im not sure its the best approach.
` public async Task DispatchEventsAsync()
{
var domainEvents = _domainEventsProvider.GetAllDomainEvents();
var domainEventNotifications = new List<IDomainEventNotification<IDomainEvent>>();
foreach (var domainEvent in domainEvents)
{
Type domainEvenNotificationType = typeof(IDomainEventNotification<>);
var domainNotificationWithGenericType = domainEvenNotificationType.MakeGenericType(domainEvent.GetType());
var domainNotification = _scope.ResolveOptional(domainNotificationWithGenericType, new List<Parameter>
{
new NamedParameter("domainEvent", domainEvent),
new NamedParameter("id", domainEvent.Id)
});
if (domainNotification != null)
{
domainEventNotifications.Add(domainNotification as IDomainEventNotification<IDomainEvent>);
}
}`
The text was updated successfully, but these errors were encountered:
Im trying to handle one DomainEvent with multiple DomainNotificationHandler that doing different task. One for emitting event for subscribe module, and one for sending automated email. Based on the current implementation of "DomainEventsDispatcher.cs" file (code below). The autofac only resolving one of my DomainNotification. I can do workaround like triggering ICommandScheduler, but im not sure its the best approach.
` public async Task DispatchEventsAsync()
{
var domainEvents = _domainEventsProvider.GetAllDomainEvents();
The text was updated successfully, but these errors were encountered: