public void Handle(RecordedEvent recordedEvent, BookOrderResult result)
        {
            var st = Encoding.ASCII.GetString(recordedEvent.Data);
            T   ev = JsonConvert.DeserializeObject <T>(st);

            DoHandle(ev, result);
        }
Beispiel #2
0
        protected override void DoHandle(BookOrderLineCreatedEvent ev, BookOrderResult result)
        {
            OrderLine ol = new OrderLine(ev.Title, ev.Price,
                                         ev.Quantity, ev.OrderLineId);

            result.BookOrder.CreateExistingOrderLine(ol);
        }
 protected override void DoHandle(BookOrderLinePriceEditedEvent ev, BookOrderResult result)
 {
     result.BookOrder.UpdateOrderLinePrice(ev.OrderLineId, ev.Price);
 }
 protected abstract void DoHandle(T ev, BookOrderResult result);
 protected override void DoHandle(BookOrderCreatedEvent ev, BookOrderResult result)
 {
     result.BookOrder = BookOrder.CreateExisting(ev.Supplier, BookOrderState.New, ev.Id,
                                                 new List <OrderLine>());
 }
 protected override void DoHandle(BookOrderLineRemovedEvent ev, BookOrderResult result)
 {
     result.BookOrder.RemoveOrderLine(ev.OrderLineId);
 }