Closed jaytonic closed 2 years ago
I believe typing NotificationLogger<>
was made on generic basis.
So most likely we should specify what type we'd love to be resolved as NotificationLogger dependency.
After looking at example of MediatR Notification feature https://github.com/jbogard/MediatR/blob/master/test/MediatR.Tests/NotificationHandlerTests.cs I'd suggest trying overriding Handle method as example to follow the example.
Generally speaking we should confirm we follow MediatR library interfaces as actual behavior does look deviated. Hope it'd help if no - text me or reply below
Thanks
Hi,
I'm starting to use MediatR's notification.
In one handler, I want to "log" every notification that comes through. According to what I found (https://stackoverflow.com/questions/70852634/mediatr-doesnt-handle-contravariant-notifications), I tried the following:
The NotificationHandler:
One of my notification:
I register the notification handler:
app.Services.AddTransient(typeof(NotificationLogger<>));
In my Program.cs, I publish the notification just before waiting on the application:
All my breakpoints gets hit, except the NotificationLogger.Handle.
Any idea why and what I could check?