protected void ApplyEvent(InvoiceDomainEvent domainEvent) { switch (domainEvent) { case InvoiceCreatedEvent invoiceCreatedEvent: Id = invoiceCreatedEvent.InvoiceId; State.AccountId = invoiceCreatedEvent.AccountId; break; case InvoiceSummaryAddedEvent InvoiceSummaryAddedEvent: break; } }
public void AddEvent(InvoiceDomainEvent domainEvent) { ApplyEvent(domainEvent); UncommittedEvents.Add(domainEvent); StreamVersion++; }