Closed grosch-intl closed 2 months ago
You can use generics out of the box in almost the same way:
public record ApprovedNotification<T>(T Checklist) : INotification
where T: IChecklist;
public sealed class NotificationHandler<T> : INotificationHandler<T>
where T : ApprovedNotification<IChecklist>
{
public Task Handle(T notification, CancellationToken cancellationToken)
{
// Do stuff
return Task.CompletedTask;
}
}
The differences:
Thank you, @MattWood21 !
Is there any way to use notifications with generics? I have this:
When I send the notification, the handler is never called. I'm guessing I need to do some type of explicit registration?