79270866

Date: 2024-12-11 07:49:04
Score: 1
Natty:
Report link

Yes, you can make your handler generic with a generic constraint.

public class CommandHandler<T> : INotificationHandler<T> where T : Notifcation
{
    //universal handler
    public Task Handle(T notification)
    {
        //serialization and logging, don't care what body will command have
    }
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: stho