您最多选择25个标签 标签必须以中文、字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. }