private void Handle(BookReceived evnt) { var key = new { LibraryId = evnt.LibraryId, BookId = evnt.BookId }; var count = _connection.GetValue <int>(key, "EventSourcing_Sample_BookStoreItem", "Count", _transaction); _connection.Update( new { Count = count + evnt.Count }, key, "EventSourcing_Sample_BookStoreItem", _transaction); }
private void Handle(BookReceived evnt) { var bookStoreItem = _bookStoreItems.Single(x => x.BookId == evnt.BookId); bookStoreItem.SetCount(bookStoreItem.Count + evnt.Count); }