source: src/FinkiChattery/FinkiChattery.Common/Mediator/MediatorService.cs@ ad058b3

dev
Last change on this file since ad058b3 was ad058b3, checked in by Стојков Марко <mst@…>, 3 years ago

Hangfire is supported

  • Property mode set to 100644
File size: 1.2 KB
Line 
1using FinkiChattery.Common.Mediator.Contracs;
2using FinkiChattery.Common.Mediator.Interfaces;
3using MediatR;
4using System.ComponentModel;
5using System.Threading;
6using System.Threading.Tasks;
7
8namespace FinkiChattery.Common.Mediator
9{
10 public class MediatorService : IMediatorService
11 {
12 private readonly IMediator mediator;
13
14 public MediatorService(IMediator mediator)
15 {
16 this.mediator = mediator;
17 }
18
19 public async Task<TResponse> SendAsync<TResponse>(ICommand<TResponse> request, CancellationToken cancellationToken)
20 {
21 return await mediator.Send(request, cancellationToken);
22 }
23
24 public async Task<TResponse> SendAsync<TResponse>(ICommand<TResponse> request)
25 {
26 return await mediator.Send(request);
27 }
28
29 public async Task PublishAsync<TNotification>(TNotification notification) where TNotification : IEvent
30 {
31 await mediator.Publish(notification, default);
32 }
33
34 [DisplayName("{0}")]
35 public async Task PublishAsync<TNotification>(string jobName, TNotification notification) where TNotification : IEvent
36 {
37 await mediator.Publish(notification, default);
38 }
39 }
40}
Note: See TracBrowser for help on using the repository browser.