public async Task SendAsync(ICommand command, CancellationToken cancellationToken = default) { var mediationStrategy = new SingleAsyncHandlerMediationStrategy<ICommand>(cancellationToken); var findStrategy = new ActualTypeOrFirstAssignableTypeMessageResolveStrategy(); await _messageMediator.Mediate(command, findStrategy, mediationStrategy); }
public Task <TQueryResult> QueryAsync <TQueryResult>(IQuery <TQueryResult> query, CancellationToken cancellationToken = default) { var mediationStrategy = new SingleAsyncHandlerMediationStrategy <IQuery <TQueryResult>, TQueryResult>(cancellationToken); var findStrategy = new ActualTypeOrFirstAssignableTypeMessageResolveStrategy(); return(_messageMediator.Mediate(query, findStrategy, mediationStrategy)); }
public async Task PublishAsync(IEvent @event, CancellationToken cancellationToken = default) { var mediationStrategy = new AsyncBroadcastMediationStrategy <IEvent>(cancellationToken); var findStrategy = new ActualTypeOrFirstAssignableTypeMessageResolveStrategy(); await _messageMediator.Mediate(@event, findStrategy, mediationStrategy); }