Table of Contents

Class NotificationHandler<TNotification>

Namespace
Mediarion
Assembly
Mediarion.dll

A notification handler with nothing to await.

public abstract class NotificationHandler<TNotification> : INotificationHandler<TNotification> where TNotification : INotification

Type Parameters

TNotification

The notification.

Inheritance
NotificationHandler<TNotification>
Implements
INotificationHandler<TNotification>
Inherited Members

Remarks

Plenty of handlers do something synchronous — add a line to a list, bump a counter, raise an event — and writing return Task.CompletedTask at the end of each is noise. Derive from this and override the void Handle instead.

Nothing else changes: it implements INotificationHandler<TNotification>, so the scan finds it and the publisher runs it like any other. The interface method is explicit so that a caller holding one of these cannot reach the asynchronous one by accident.

Methods

Handle(TNotification)

Handles the notification.