コード例 #1
0
        // SAMPLE: completing-saga
        public void Handle(
            SodaFetched soda,            // The first argument is the message type

            HappyMealOrderState state,   // This matches the state document type, so it will be the
                                         // state document matching the current saga identified by
                                         // the incoming message envelope

            IOrderService service        // Additional arguments are injected services


            )
        {
            state.DrinkReady = true;

            // Determine if the happy meal is completely ready
            if (state.IsOrderComplete())
            {
                // Maybe you need to remove this
                // order from some kind of screen display
                service.Close(state.Id);

                // And we're done here, so let's mark the Saga as complete
                MarkCompleted();
            }
        }
コード例 #2
0
        // SAMPLE: completing-saga
        public void Handle(
            SodaFetched soda,     // The first argument is the message type
            IOrderService service // Additional arguments are injected services
            )
        {
            State.DrinkReady = true;

            // Determine if the happy meal is completely ready
            if (State.IsOrderComplete())
            {
                // Maybe you need to remove this
                // order from some kind of screen display
                service.Close(State.Id);

                // And we're done here, so let's mark the Saga as complete
                MarkCompleted();
            }
        }