Ejemplo n.º 1
0
        private static CreateBidHistoryCommand CreateBidHistoryCommand(BidPlacedOnAuction @event)
        {
            var bidHistoryCommand = new CreateBidHistoryCommand()
            {
                AuctionId      = @event.AuctionId,
                BidderId       = @event.BidderId,
                CreateDateTime = @event.OfferDateTime,
                OfferedAmount  = @event.Amount
            };

            return(bidHistoryCommand);
        }
Ejemplo n.º 2
0
        public void PlaceBid(PlaceBidOnAuctionCommand command)
        {
            BidPlacedOnAuction @event = null;

            _listener.Subscribe(new ActionEventHandler <BidPlacedOnAuction>(a => @event = a));

            //TODO: replace this transctional consistency with eventual consistency using NSB
            using (var scope = new TransactionScope())
            {
                _bus.Dispatch(command);
                var bidHistoryCommand = CreateBidHistoryCommand(@event);
                _bus.Dispatch(bidHistoryCommand);

                scope.Complete();
            }
        }