internal static BasketManager ResolveManager()
        {
            BasketRepository basketRepository = 
                new SqlBasketRepository(
                    BasketContainer.connectionString);
            DiscountRepository discountRepository =
                new SqlDiscountRepository(
                    BasketContainer.connectionString);

            BasketDiscountPolicy discountPolicy = 
                new RepositoryBasketDiscountPolicy(
                    discountRepository);

            IBasketService basketService = 
                new BasketService(basketRepository,
                    discountPolicy);

            return new BasketManager(basketService);
        }
        protected override IController GetControllerInstance(
            RequestContext requestContext, Type controllerType)
        {
            string connectionString =
                ConfigurationManager.ConnectionStrings
                ["CommerceObjectContext"].ConnectionString;

            var productRepository =
                new SqlProductRepository(connectionString);
            var basketRepository =
                new SqlBasketRepository(connectionString);
            var discountRepository =
                new SqlDiscountRepository(connectionString);

            var discountPolicy =
                new RepositoryBasketDiscountPolicy(
                    discountRepository);

            var basketService =
                new BasketService(basketRepository,
                    discountPolicy);

            var currencyProvider = new CachingCurrencyProvider(
                new SqlCurrencyProvider(connectionString),
                TimeSpan.FromHours(1));

            if (controllerType == typeof(BasketController))
            {
                return new BasketController(
                    basketService, currencyProvider);
            }
            if (controllerType == typeof(HomeController))
            {
                return new HomeController(
                    productRepository, currencyProvider);
            }

            return base.GetControllerInstance(
                requestContext, controllerType);
        }