Closed dominique-ruest closed 6 months ago
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
This issue was closed because it has been stalled for 14 days with no activity.
Consider the two following notificaiton handlers:
public class DocumentSignedNotificationSender : INotificationHandler<DocumentSigned>
public class PersistDomainEventsHandler<TNotification> : INotificationHandler<TNotification> where TNotification : DomainEvent
When publishing a DocumentSigned event, only the first handler is called but not the generic one. When publishing a second event, let's say 'DocumentUploaded' which has no specific handler, the generic handler does get called.
Services are registered with
Services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblyContaining<Program>())
If I add the following registration code, the generic handler gets called once in the first scenario and twice in the other.
.Services.AddTransient(typeof(INotificationHandler<>), typeof(PersistDomainEventsHandler<>))
Is this a bug? Am I missing something configuration wise? Thx!