protected override IEngine CreateEngine() { NinjectServiceContainer.SetKernel(null); // force new kernel var engine = new ContentEngine(new NinjectServiceContainer(), EventBroker.Instance, new ContainerConfigurer()); return(engine); }
/// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static IKernel CreateKernel() { //var kernel = new StandardKernel(new NinjectSettings() { UseReflectionBasedInjection = true }); // medium trust - see https://github.com/ninject/ninject.web.mvc/issues/15 var kernel = new StandardKernel(); // var kernel = new StandardKernel(new NinjectSettings { LoadExtensions = false }); // kernel.Load(new Ninject.Web.Mvc.MvcModule()); kernel.Bind <Func <IKernel> >().ToMethod(ctx => () => new Bootstrapper().Kernel); kernel.Bind <IHttpModule>().To <HttpApplicationInitializationHttpModule>(); RegisterServices(kernel); // this will ensure that n2 uses the same kernel NinjectServiceContainer.SetKernel(kernel); return(kernel); }
public void SetUp() { NinjectServiceContainer.SetKernel(null); // force new kernel container = new NinjectServiceContainer(); }