public async Task Publish(IDomainEvent notification, CancellationToken cancellationToken = default) { var type = notification.GetType(); var adapterType = typeof(NotificationAdapter <>).MakeGenericType(type); var adapter = Activator.CreateInstance(adapterType, notification) as INotification; await mediator.Publish(adapter); }
public async Task Publish <T>(T @event) where T : INotification { await _mediator.Publish(@event); }
async ValueTask IEventBus.TriggerAsync <T>(EventData <T> eventData, CancellationToken cancellationToken) { await _mediator.Publish(eventData.EventArgs, cancellationToken); }
public async Task Post() { int val = Interlocked.Increment(ref Counter); await _mediator.Publish(new CounterIncremented(val)); }