Exemplo n.º 1
0
        public void SubmitOrder(Order order)
        {
            //该处可以做成可以配置,根据配置来选择业务规则
            var spec = _orderSpecManager.GetSpecification(CustomerType.Vip);

            if (order.Customer.CustomerType == CustomerType.Vip && spec(order))
            {
                //处理VIP订单逻辑
            }
            else if (order.Customer.CustomerType == CustomerType.Normal && spec(order))
            {
                //处理普通订单逻辑
            }
        }