Beispiel #1
0
    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);
    }
Beispiel #2
0
    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));
    }
Beispiel #3
0
    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);
    }