You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

MediatrMessageReceivedHandler.cs 474 B

1234567891011121314151617
  1. // MessageReceivedHandler.cs
  2. using System;
  3. using MediatR;
  4. using MediatRSample.Notifications;
  5. namespace MediatRSample;
  6. public class MessageReceivedHandler : INotificationHandler<MessageReceivedNotification>
  7. {
  8. public async Task Handle(MessageReceivedNotification notification, CancellationToken cancellationToken)
  9. {
  10. Console.WriteLine($"MediatR works! (Received a message by {notification.Message.Author.Username})");
  11. // Your implementation
  12. }
  13. }