コード例 #1
0
        public PurchaseService(IProductRepository productRepository,
                               IPointsPromotionRepository pointsPromotionRepository,
                               IDiscountPromotionRepository discountPromotionRepository,
                               IDiscountPromotionProductRepository discountPromotionProductRepository)
        {
            ProductRepository                  = productRepository;
            PointsPromotionRepository          = pointsPromotionRepository;
            DiscountPromotionRepository        = discountPromotionRepository;
            DiscountPromotionProductRepository = discountPromotionProductRepository;

            // Again, in the real-world, structured logging should be used throughout the code base, e.g. inject ILogger<PurchaseService> here.
        }
コード例 #2
0
 public RewardsService(IDiscountRepository discountRepository, IPointsPromotionRepository pointsPromotionRepository)
 {
     //Promotions repository and Discount reository are clubbed together as the reward points should be calculated on net dollar spent.
     _discountRepository        = discountRepository ?? throw new ArgumentNullException(nameof(discountRepository));
     _pointsPromotionRepository = pointsPromotionRepository ?? throw new ArgumentNullException(nameof(pointsPromotionRepository));
 }