コード例 #1
0
        public void PublishToProjection(UpdatePriceCommand updatePriceCommand)
        {
            Thread.Sleep(3000);
            if(!ProductProjections.ProductRepo.ContainsKey(updatePriceCommand.ProductId))
                return;

            var product = ProductProjections.ProductRepo[updatePriceCommand.ProductId];
            product.Price = updatePriceCommand.NewPrice;
            ProductProjections.ProductRepo[updatePriceCommand.ProductId] = product;
        }
コード例 #2
0
        public AjaxContinuation Post(UpdatePriceCommand updatePriceCommand)
        {
            Thread.Sleep(5000);
            var commandHandler = new CQRS.UpdatePriceCommandHandler();
            updatePriceCommand.CommandId = Guid.NewGuid();

            commandHandler.Publish(updatePriceCommand);

            var continuation = AjaxContinuation.Successful();
            return continuation;
        }
コード例 #3
0
 public void Publish(UpdatePriceCommand updatePriceCommand)
 {
     EventRepo.Add(updatePriceCommand.CommandId, updatePriceCommand);
     ThreadPool.QueueUserWorkItem(x => PublishToProjection(updatePriceCommand));
 }