示例#1
0
 public void Execute(params BehaviourDefinition[] behaviorDefinition)
 {
     foreach (BehaviourDefinition defination in behaviorDefinition)
     {
         IBehavior behavior = Activator.CreateInstance(defination.BehaviorType) as Behavior;
         behavior.Execute();
     }
 }
示例#2
0
        public async Task Execute(BehaviorContext <OrderState, OrderAccepted> context,
                                  IBehavior <OrderState, OrderAccepted> next)
        {
            Console.WriteLine($"Hello, World. Order is {context.Data.OrderId}");

            var consumeContext = context.GetPayload <ConsumeContext>();

            var sendEndpoint = await consumeContext.GetSendEndpoint(new Uri("queue:fulfill-order")); // FulfillOrder

            await sendEndpoint.Send <FulfillOrder>(new
            {
                context.Data.OrderId,
                context.Instance.CustomerNumber,
                //context.Instance.PaymentCardNumber,
            });

            await next.Execute(context).ConfigureAwait(false);
        }