Exemplo n.º 1
0
        public static ShoppingCart GetCart(HttpContextBase context)
        {
            var ioc = new IoC();

            var cartAppService = ioc.Kernel.Get<ICartAppService>();
            var orderDetailAppService = ioc.Kernel.Get<IOrderDetailAppService>();
            var orderAppService = ioc.Kernel.Get<IOrderAppService>();

            var cart = new ShoppingCart(cartAppService, orderDetailAppService, orderAppService);
            cart.ShoppingCartId = cart.GetCartId(context);
            return cart;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var ioc = new IoC();
            var kernel = ioc.Kernel;
            try
            {
                kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

                RegisterServices(kernel);
                return kernel;
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }