private void Ready() { Receive <CartQuery>(q => { Sender.Tell(_cartProjection); }); ReceiveAsync <ItemAddedToCart>(async i => { var product = await _inventoryQueryActor.Ask <ProductProjection>(new ProductQuery(i.ProductId)); _cartProjection.Products.Add(product); _projectionStore.Store(_userId, _cartProjection.Type, JsonConvert.SerializeObject(_cartProjection)); }); }
private void Persist() { _projectionStore.Store(Guid.Empty, InventoryProjection.ProjectionType, JsonConvert.SerializeObject(_projection)); }