Пример #1
0
            public static void Main()
            {
                var checkItemOutPipeline =
                    new LoggingHndler <CheckItemOut>(
                        new CheckItemOUtHandler());


                checkItemOutPipeline.Handle(new CheckItemOut(10));
                //or
                var bucket = new InventoryBucket();

                bucket.CheckItemIn(100);
                bucket.CheckItemOut(10);
                bucket.CheckItemOut(10);
                bucket.CheckItemIn(100);

                var history = bucket.GetProducedEvents();
                //save in the database

                var item = new InventoryBucket(history);

                Console.WriteLine(item);
            }
Пример #2
0
            public void Handle(CheckItemOut message)
            {
                // Load object from history
                var obj = new InventoryBucket(history);

                // Call CheckItemOut
                obj.CheckItemOut(message.Quantity);

                var producedEvents = obj.GetProducedEvents();

                if (producedEvents.Count > 0)
                {
                    history.AddRange(producedEvents);

                    foreach (var e in producedEvents)
                    {
                        Console.WriteLine("Produced: " + e);
                    }
                }
            }