source: src/FinkiChattery/FinkiChattery.Common/Mediator/MediatorService.cs@ 7f1a891

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

Get question state endpoint

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[ad058b3]1using FinkiChattery.Common.Mediator.Contracs;
[e6a6d9a]2using FinkiChattery.Common.Mediator.Interfaces;
[ad058b3]3using MediatR;
4using System.ComponentModel;
[e6a6d9a]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 }
[ad058b3]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 }
[b25b9ea]39
40 public async Task<TResponse> SendQueryAsync<TResponse>(IQuery<TResponse> request, CancellationToken cancellationToken)
41 {
42 return await mediator.Send(request, cancellationToken);
43 }
44
45 public async Task<TResponse> SendQueryAsync<TResponse>(IQuery<TResponse> request)
46 {
47 return await mediator.Send(request);
48 }
[e6a6d9a]49 }
50}
Note: See TracBrowser for help on using the repository browser.