protected override IKernel CreateKernel()
        {
            NinjectSettings settings = new NinjectSettings() { InjectNonPublic = true };

            Kernel = new StandardKernel(settings, new CoreBindingModule(), new DataAccessBindingModule());

            Kernel.Bind<HttpContext>().ToMethod(ctx => HttpContext.Current).InTransientScope();
            Kernel.Bind<HttpContextBase>().ToMethod(ctx => new HttpContextWrapper(HttpContext.Current)).InTransientScope();

            _controllerFactory = new NinjectControllerFactory(Kernel);

            return Kernel;
        }
Exemplo n.º 2
0
 public static void SetControllerFactory()
 {
     var controllerFactory = new NinjectControllerFactory(Kernel);
     ControllerBuilder.Current.SetControllerFactory(controllerFactory);
 }