private INotification GetNotificationCorrespondingToDomainEvent(DomainEvent domainEvent) { return((INotification)Activator.CreateInstance(typeof(DomainEventNotification <>).MakeGenericType(domainEvent.GetType()), domainEvent)); }
public async Task Publish(DomainEvent domainEvent) { _logger.LogInformation("Publishing domain event. Event - {event}", domainEvent.GetType().Name); await _mediator.Publish(GetNotificationCorrespondingToDomainEvent(domainEvent)); }