public Invoice(Guid id) { Id = id; _invoiceLines = new List <InvoiceLine>(); _invoiceHistory = new List <string>(); var eventRouter = new RegistrationEventRouter(); eventRouter.Register <InvoiceCreatedEvent>(ApplyInvoiceCreated); eventRouter.Register <LineAuhtorizedEvent>(ApplyLineAuthorized); RegisteredRoutes = eventRouter; RegisteredRoutes.Register(this); }
public void ApplyEvent(object @event) { RegisteredRoutes.Dispatch(@event); }
/// <summary> /// Get the route at <paramref name="index"/>. /// </summary> /// <param name="index">The route's index.</param> public IRoutable <TRoutingContext> this[int index] => RegisteredRoutes.ElementAt(index);