using System.Web.Mvc;
using NetMagazine_MVC3_Parte3.Models;
using Ninject;
using Ninject.Mvc3;

[assembly: WebActivator.PreApplicationStartMethod(typeof(NetMagazine_MVC3_Parte3.AppStart_NinjectMVC3), "Start")]

namespace NetMagazine_MVC3_Parte3
{
    public static class AppStart_NinjectMVC3
    {
        public static void RegisterServices(IKernel kernel)
        {
            kernel.Bind<IListaDePedidos>().To<RepositorioPedidos>();
        }

        public static void Start()
        {
            // Create Ninject DI Kernel 
            IKernel kernel = new StandardKernel();

            // Register services with our Ninject DI Container
            RegisterServices(kernel);

            // Tell ASP.NET MVC 3 to use our Ninject DI Container 
            DependencyResolver.SetResolver(new NinjectServiceLocator(kernel));
        }
    }
}
