public async Task ExecuteAsync(HookType type, IDomainEntityContext <Invoice> context, CancellationToken cancellationToken) { switch (context.EditMode) { case EditMode.Create: await context.AddEventAsync(InvoiceCreatedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken); break; case EditMode.Update: await context.AddEventAsync(InvoiceUpdatedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken); break; case EditMode.Delete: await context.AddEventAsync(InvoiceDeletedEvent.Create(_correlationIdProvider.Id, context.Entity.Id, _currentUser.Id), cancellationToken); break; } }
public async Task Handle(InvoiceUpdatedEvent notification, CancellationToken cancellationToken) { _logger.LogInformation("InvoiceUpdatedEvent: {invoice}", notification); return; }
public void Handle(InvoiceUpdatedEvent evt) { _logger.LogInformation(GetLogMessage("Invoice updated event triggered")); }
protected void When(InvoiceUpdatedEvent @event) { CustomerFullName = @event.CustomerFullName; CustomerAddress = @event.CustomerAddress; }