Create <TAggregateRoot, TDomainEventBase>( TAggregateRoot aggregateRoot, ApplyEventRouter <TAggregateRoot, TDomainEventBase> applyEventRouter) { var commandResult = new CommandResult <TAggregateRoot, TDomainEventBase>(aggregateRoot); return(new CommandExecutionContext <TAggregateRoot, TDomainEventBase>(commandResult, applyEventRouter)); }
static ShoppingCart() { var routes = new ApplyEventRouterBuilder <ShoppingCart, IDomainEvent>(); routes.Add <ShoppingCartCreated>((agg, e) => agg.Apply(e)); routes.Add <ItemAddedToShoppingCart>((agg, e) => agg.Apply(e)); ApplyEventRouter = routes.Build(); }