private static CreateBidHistoryCommand CreateBidHistoryCommand(BidPlacedOnAuction @event) { var bidHistoryCommand = new CreateBidHistoryCommand() { AuctionId = @event.AuctionId, BidderId = @event.BidderId, CreateDateTime = @event.OfferDateTime, OfferedAmount = @event.Amount }; return(bidHistoryCommand); }
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(); } }