/// <summary> /// Handle ProductRegisteredEvent. /// </summary> /// <param name="productRegisteredEvent">ProductRegisteredEvent instance.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>Asynchronous task which can be awaited for completion.</returns> public Task HandleProductRegisteredEventAsync(ProductRegisteredEvent productRegisteredEvent, CancellationToken cancellationToken) { // Add product to read-side repository if event is received. return(_productReadSideRepository.AddProductAsync(new ProductReadModel() { ProductId = productRegisteredEvent.ProductId, ProductName = productRegisteredEvent.ProductName })); }
private Product(ProductRegisteredEvent @event) => ApplyChange <Product>(@event);
private void OnProductRegisteredEvent(ProductRegisteredEvent domainEvent) { Name = domainEvent.ProductName; }