Example #1
0
 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);
 }
Example #2
0
 public async Task Publish <T>(T @event)
     where T : INotification
 {
     await _mediator.Publish(@event);
 }
Example #3
0
 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));
 }