Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 public async Task Publish <T>(T @event)
     where T : INotification
 {
     await _mediator.Publish(@event);
 }
Ejemplo n.º 3
0
 async ValueTask IEventBus.TriggerAsync <T>(EventData <T> eventData, CancellationToken cancellationToken)
 {
     await _mediator.Publish(eventData.EventArgs, cancellationToken);
 }
Ejemplo n.º 4
0
 public async Task Post()
 {
     int val = Interlocked.Increment(ref Counter);
     await _mediator.Publish(new CounterIncremented(val));
 }