コード例 #1
0
        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;
            }
        }
コード例 #2
0
        public async Task Handle(InvoiceUpdatedEvent notification, CancellationToken cancellationToken)
        {
            _logger.LogInformation("InvoiceUpdatedEvent: {invoice}", notification);

            return;
        }
コード例 #3
0
 public void Handle(InvoiceUpdatedEvent evt)
 {
     _logger.LogInformation(GetLogMessage("Invoice updated event triggered"));
 }
コード例 #4
0
 protected void When(InvoiceUpdatedEvent @event)
 {
     CustomerFullName = @event.CustomerFullName;
     CustomerAddress  = @event.CustomerAddress;
 }