常用方法
常用方法
常用方法
常用方法
public async Task DispatchAsync(IMessage message) { if (message is ICommand command) { await _commandDispatcher.DispatchAsync(command); } else if (message is IEvent @event) { await _eventDispatcher.DispatchIntegrationEventAsync(@event); } else { throw new InvalidOperationException("Message is neither command nor event."); } }