Example #1
0
        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);
        }
Example #2
0
 public void ApplyEvent(object @event)
 {
     RegisteredRoutes.Dispatch(@event);
 }
Example #3
0
 /// <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);